Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 699497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:23:34+00:00 2026-05-14T03:23:34+00:00

Probably I’m just missing something obvious, but I can’t get the image in my

  • 0

Probably I’m just missing something obvious, but I can’t get the image in my DataTemplate to align to the right in the Grid, so that when the window is stretched, the image is “pulled” to the right as well:

<Window.Resources>
    <DataTemplate x:Key="PersonTemplate" DataType="Minimal.Client.Person">
        <Border BorderBrush="Purple" BorderThickness="2" CornerRadius="2" Padding="5" Margin="5">
            <Grid Margin="10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" MinWidth="200"/>
                    <ColumnDefinition Width="Auto" MaxWidth="200"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column ="0" Orientation="Horizontal" >
                    <TextBlock FontFamily="Verdana" FontSize="16" FontWeight="Bold" Text="{Binding LastName}" />
                    <TextBlock FontFamily="Verdana" FontSize="16" Text=", " />
                    <TextBlock FontFamily="Verdana" FontSize="16" Text="{Binding FirstName}" />
                </StackPanel>
                <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Right">
                    <Border BorderBrush="Black" BorderThickness="1">
                        <Image Source="{Binding Picture}" Width="180" Height="150" />
                    </Border>
                </StackPanel>
            </Grid>
        </Border>
    </DataTemplate>
</Window.Resources>

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:23:34+00:00Added an answer on May 14, 2026 at 3:23 am

    I think the problem is that you have set a MaxWidth of 200 for the second column (where the Image is contained). Therefore, the column will not be any wider than 200 pixels and the two columns will not use the complete available space. If you insert another column in between the two columns and make this one star-sized, the Image will be right-aligned:

    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" MinWidth="200"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto" MaxWidth="200"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column ="0" Orientation="Horizontal" >
            <TextBlock FontFamily="Verdana" FontSize="16" FontWeight="Bold" Text="{Binding LastName}" />
            <TextBlock FontFamily="Verdana" FontSize="16" Text=", " />
            <TextBlock FontFamily="Verdana" FontSize="16" Text="{Binding FirstName}" />
        </StackPanel>
        <StackPanel Grid.Column="2" Orientation="Vertical" HorizontalAlignment="Right">
            <Border BorderBrush="Black" BorderThickness="1">
                <Image Source="{Binding Picture}" Width="180" Height="150" />
            </Border>
        </StackPanel>
    </Grid>
    

    This way, it works for me. However, you should be careful when using StackPanels. They always take as much space as they need. And if they are not given that much space, part of the content will simply be hidden.

    gehho.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Probably missing something completely obvious here, but here goes. I'm starting out with Spring
Probably I'm just too dump for googling, but I always thought char arrays get
Probably something really simple, but I'm having some real trouble with it. I have
Probably something simple, but heres my problem, I have implememnted a simple captcha into
Probably right in front of me, but I am not sure how to set
Probably a bit off topic question, but it's something I'm really interested in getting
Probably this will not result in any noticable performance difference, but I was just
Probably very simple question (I just want to ensure I'm right). Title is not
Probably a simple question this, but... I can apply CSS to all images using
Probably easy to do but I can't seem to generate the correct regex. Say

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.