Reputation: 9684
I am trying to embed multiple grids within another grid using an ItemsControl
and have all the child grids share the same row heights:
<Grid>
<ItemsControl ItemsSource="{Binding ControlItems}">
<ItemsControl.ItemsPanel>
<CustomPanel></CustomPanel>
</ItemsControl.ItemsPanel>
<ItemsControl.DataTemplate>
<CustomControl/>
</ItemsControl.DataTemplate>
</ItemsControl>
</Grid>
Where CustomControl is actually a customized Grid something like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="CustomControlGroup" />
<RowDefinition SharedSizeGroup="CustomControlGroup" />
<Grid.RowDefinitions>
</Grid>
However the rows in the child grids do not share the same size?
Upvotes: 2
Views: 864
Reputation: 4865
Well according to this article. You must set the IsSharedSizeScope
property in a parent control to True
. So probably it should look more like:
<ItemsControl Grid.IsSharedSizeScope="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="CustomControlGroup" />
<RowDefinition SharedSizeGroup="CustomControlGroup" />
<Grid.RowDefinitions>
</Grid>
</ItemsControl>
Here is another example from the MSDN. IMHO, the first article is more understandable.
Upvotes: 3