I use an ItemsControl representing Countries. For each country I use a ListView for showing its cities:
<ItemsControl ItemsSource="{Binding Countries}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ListView Margin="10"
ItemsSource="{Binding Cities}">
<ListView.View>
<GridView>
<GridViewColumn Width="140"
Header="City"
DisplayMemberBinding="{Binding Name}" />
<GridViewColumn Width="90"
Header="Population"
DisplayMemberBinding="{Binding Population}" />
</GridView>
</ListView.View>
</ListView>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
The result:
I need that whenever the user changes a column width in the first listview the second one adjust its width accordingly (something like SharedGroupSize for grids).
How can I accomplish this?
Create a custom UserControl which has a dependency property for each column width. Then two-way bind column widths to them.
and code behind