Question:
How can you change RowDefinitions or ColumnDefinitions Grid at runtime using only XAML and codeless binding ?
I have an ItemsControl element that shows its elements in a Grid , this Grid has dynamic RowDefinitions as follows:
<ItemsControl Name="myItemsControl" ItemsSource="{Binding Cells}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid Name="myGrid"> <Grid.RowDefinitions> </Grid.RowDefinitions> <Grid.ColumnDefinitions> </Grid.ColumnDefinitions> </Grid> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemContainerStyle> <Style.../> </ItemsControl.ItemContainerStyle> </ItemsControl>
I tried adding the RowDefinition code to the code behind, but I could not find a way to access myGrid since it is inside myGrid ItemsPanelTemplate .
I am wondering if there is a way to programmatically add or change RowDefinitions at runtime ?
Bizhan
source share