So, I have 3 user controls :
1. SectionV.xaml
<UserControl x:Class="NumberedMusicalScoresWriter.V.SectionV"...>
...
<Grid Background="{Binding BackgroundColor, Mode=OneWay}" Grid.IsSharedSizeScope="True">
...
<V:BarV Grid.Column="0" Grid.Row="0" DataContext="{Binding GClefBarVM, Mode=OneWay}"/>
<V:BarV Grid.Column="0" Grid.Row="2" DataContext="{Binding FClefBarVM, Mode=OneWay}"/>
</Grid>
...
2. BarV.xaml
<UserControl x:Class="NumberedMusicalScoresWriter.V.BarV"...>
...
<Grid Background="{Binding BackgroundColor, Mode=OneWay}">
...
<ItemsControl Grid.Column="0" Grid.Row="0"
ItemsSource="{Binding NotationGroupVMs, Mode=OneWay}">
...
<ItemsControl.ItemTemplate>
<DataTemplate>
<V:NotationGroupV/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
...
3. NotationGroupV.xaml
<UserControl x:Class="NumberedMusicalScoresWriter.V.NotationGroupV"...>
...
<Grid Background="{Binding BackgroundColor, Mode=OneWay}">
...
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" SharedSizeGroup="Mid"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
...
</Grid>
...
As you have figured, NotationGroupV
is a collection of UserControl
in BarV
, and BarV
is owned by SectionV
as a two of. (SectionV
is also used as a collection member of its parent control)
The issue is on the center row height of NotationGroupV
, which has SharedSizeGroup="Mid"
. I want to share it to fellow NotationGroupV
in the apps.
So, basically, I want to share SharedSizeGroup
to other NotationGroupV
in different parents.
Anyone know how to expose SharedSizeGroup
this way?
(Please ask anything to clarify)
Thank you.
P.S. In this link, it's explained how to share them in a different grid, BUT in the same xaml.
While I can't confirm for sure that your requirement will work, I can confirm that as long as you set the Grid.IsSharedSizeScope
Attached Property to True
on a parent container control of both of the Grid
s that you have set up SharedSizeGroup
s for, then it should work. To find out for sure, just try it out... you could have probably tested it yourself quicker than the time it took you to write this question.
If there is no parent container control at the moment, just add one.... (put everything into it).
The important thing to note here is that you're only supposed to set Grid.IsSharedSizeScope
to True
on the one single parent container control and not on every Grid
.