Xaml 绑定到网格内的CollectionViewSource
我有一个轴视图,有两个这样的轴Xaml 绑定到网格内的CollectionViewSource,xaml,uwp,Xaml,Uwp,我有一个轴视图,有两个这样的轴 <Pivot ItemsSource="{Binding Pivots}" ItemTemplate="{StaticResource PivotTemplate}" /> <DataTemplate x:Key="PivotTemplate" x:DataType="viewModels:MainPagePivot"> <PivotItem> <Gr
<Pivot ItemsSource="{Binding Pivots}"
ItemTemplate="{StaticResource PivotTemplate}" />
<DataTemplate x:Key="PivotTemplate"
x:DataType="viewModels:MainPagePivot">
<PivotItem>
<Grid>
<Grid.Resources>
<CollectionViewSource x:Name="documents"
Source="{x:Bind DocumentGroups}"
IsSourceGrouped="True"
ItemsPath="Documents" />
</Grid.Resources>
<SemanticZoom Grid.Row="1">
<SemanticZoom.ZoomedInView >
<GridView ItemsSource="{Binding Source={StaticResource documents}}" />
</SemanticZoom.ZoomedInView>
</SemanticZoom>
</Grid>
</PivotItem>
</DataTemplate>
我的ItemTemplate是这样的
<Pivot ItemsSource="{Binding Pivots}"
ItemTemplate="{StaticResource PivotTemplate}" />
<DataTemplate x:Key="PivotTemplate"
x:DataType="viewModels:MainPagePivot">
<PivotItem>
<Grid>
<Grid.Resources>
<CollectionViewSource x:Name="documents"
Source="{x:Bind DocumentGroups}"
IsSourceGrouped="True"
ItemsPath="Documents" />
</Grid.Resources>
<SemanticZoom Grid.Row="1">
<SemanticZoom.ZoomedInView >
<GridView ItemsSource="{Binding Source={StaticResource documents}}" />
</SemanticZoom.ZoomedInView>
</SemanticZoom>
</Grid>
</PivotItem>
</DataTemplate>
当我有多个pivot
项时,引用Binding Source={StaticResource documents}
总是引用我的第一个pivot
有没有办法让它引用当前迭代?可能会使
CollectionViewSource
name动态,并将差异同上?Where\粘贴错误的静态资源“cvsGroups”是什么。我现在已经修复了它。首先,删除数据模板中的
标记,您不需要它们。很遗憾,它不能解决问题。不过还是要谢谢你,少代码更好