I need to create dynamic row and columns base on the parameter, like in my json I will have x and y which will be no. of rows and columns respectively, and there will be content with x and y which I have to put them in their respective row and column, I tried to use below code but found that uniform grid is not available in UWP App. Also thought about DataTemplateSelector, but am not sure if that is a good idea to use it.
Xaml:
<ItemsControl ItemsSource="{Binding MyCollection}">
<!-- This panel will be used to hold the items -->
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<un Rows="8"
Columns="8" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<!-- Each item will be drawn using this template -->
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Content="{Binding }"
Style="{StaticResource MyButtonStyle}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Please anybody can guide me what approach should I follow.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…