I have a Windows Phone / XAML Grid composed by 3 columns. In particular, I want the third column to be aligned to the very right side of the screen.
<Grid Background="Transparent" Margin="0,3">         <Grid.ColumnDefinitions>             <ColumnDefinition Width="Auto"/>             <ColumnDefinition Width="*"/>             <ColumnDefinition Width="Auto"/>         </Grid.ColumnDefinitions>      <Image Grid.Column="0" x:Name="Marker" Width="60" Height="60" VerticalAlignment="Center" Stretch="Uniform" HorizontalAlignment="Center"/>     <TextBlock Grid.Column="1" x:Name="Name" TextAlignment="Left" VerticalAlignment="Center" Margin="20,0" />     <Image Grid.Column="2" x:Name="Selected" Width="48" Height="48"  VerticalAlignment="Center" Stretch="Uniform" HorizontalAlignment="Center"/>  </Grid> The result, instead, is this:

When it should be like this:

Instead set column width:100px inside the grid, because grid is the container also use justify-content:end; to align the content to the right side.
Use width:100% on the table and the middle column. You could also set width:100% on the last column's style and td align="right" on the last column. Then you can insert more columns in the middle while the spacing still works.
To center the <div> element horizontally using grid. Use the property of display set to grid i.e. display: grid; Then use property place-items: center; Example: The following example demonstrates to set the <div> to the center using grid property.
As you mentioned its an ItemTemplate of ListBox, what you can do is set HorizontalContentAlignment to Stretch.
    <ListBox>         <ListBox.ItemContainerStyle>             <Style TargetType="ListBoxItem">                 <Setter Property="HorizontalContentAlignment" Value="Stretch"/>             </Style>         </ListBox.ItemContainerStyle>     </ListBox> If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With