我GridView
在 Windows 8 Metro 应用程序中使用分组,我有一个VariableSizedWrapGrid
in ItemsPanelTemplate
,并且想要绑定该MaximumRowsOrColumns
属性,但它没有正确绑定。
这是我的 XAML
<GridView ItemsSource="{Binding Source={StaticResource groupeddata}}" >
<GridView.ItemTemplate>
<DataTemplate>
<Grid Width="120" Height="150" >
<!--some controls here binded correctly.-->
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<Grid Margin="1,0,0,6">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding maxGridCoulmns}"></TextBlock>
<!--work ok here -->
<TextBlock Foreground="Black" Padding="0,0,0,20" Text="{Binding headerText}" />
</StackPanel>
</Grid>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.Panel >
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Horizontal" MaximumRowsOrColumns="{Binding maxGridCoulmns}" Margin="0,0,80,0"/>
<!--not binding here -->
</ItemsPanelTemplate>
</GroupStyle.Panel>
</GroupStyle>
</GridView.GroupStyle>
</GridView>