Reputation: 451
I have listbox which will show the list of text and its status. How shall i show the text in the left side and Status control on the right most side? This is how i was trying.
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel>
<TextBlock DockPanel.Dock="Left" Text="{Binding Path=Name}" Style="{StaticResource TextBlockTitle}"/>
<ContentControl DockPanel.Dock="Right" HorizontalAlignment="Right" Content="{Binding Status}" ContentTemplate="{StaticResource StatusTemplate}" />
</DockPanel>
</DataTemplate>
This code is showing the status control just after the text.
Upvotes: 0
Views: 40
Reputation: 184476
Would use a Grid
with two columns:
*
sizedAuto
sized (or set a SharedSizeGroup
if you want synchronization between items)The first column will take up all space left. For size sharing you will also need to set Grid.IsSharedSizeScope
on e.g. the ListBox
element.
The items also need to be stretched.
Upvotes: 2