Reputation: 1438
I have a list view with no columns and i want my 3 Labels to have 3 different horizontal alignments (Left , Center , Right) so when resizing the Window (and ListView resizes too) the the 1st Label should be on the far left side , the 2nd shall be on the Center and the 3rd on the far right side of the item
Here is my XAML attempt
<ListView.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Label Content="L1" Margin="0,10,0,0" VerticalAlignment="Top" Height="50" HorizontalAlignment="Left" Width="80"/>
<Label Content="L2" Margin="0,10,0,0" VerticalAlignment="Top" Height="50" HorizontalAlignment="Center" Width="80"/>
<Label Content="L3" Margin="0,10,0,0" VerticalAlignment="Top" Height="50" HorizontalAlignment="Right" Width="80"/>
</WrapPanel>
</DataTemplate>
</ListView.ItemTemplate>
Upvotes: 0
Views: 31
Reputation: 539
Set the HorizontalContentAlignment
property of the ListView
to Stretch
and it should work. (Default is Left
)
Also, you can place your 3 labels in a Grid
instead of a WrapPanel
.
Upvotes: 1