WPF: Horizontal Alignment
- by emptyset
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?