Xaml 语义缩放不显示任何结果

Xaml 语义缩放不显示任何结果,xaml,gridview,windows-8,winrt-xaml,semantic-zoom,Xaml,Gridview,Windows 8,Winrt Xaml,Semantic Zoom,在多次尝试运行此功能后,我最终完全迷路了。 仅显示组标题,并且仅在ZoomInView中显示。 我错在哪里? 我的所有数据都是从web api服务加载的,但我认为CollectionViewSource是可观察的,这不会是问题的根源 这些是我的poco课程 public class StopInformation { public string Name { get; set; } public string Number { get; set; } } public cla

在多次尝试运行此功能后,我最终完全迷路了。 仅显示组标题,并且仅在ZoomInView中显示。 我错在哪里? 我的所有数据都是从web api服务加载的,但我认为CollectionViewSource是可观察的,这不会是问题的根源

这些是我的poco课程

public class StopInformation
{
    public string Name { get; set; }

    public string Number { get; set; }
}

public class ScheduleDirection
{
    public string Direction { get; set; }

    public IEnumerable<StopInformation> Stops { get; set; }
}
公共类停止信息
{
公共字符串名称{get;set;}
公共字符串编号{get;set;}
}
公共类调度方向
{
公共字符串方向{get;set;}
公共IEnumerable Stops{get;set;}
}
ViewModel成员

public ObservableCollection<ScheduleDirection> Directions { get; set; }
publicobservableCollection方向{get;set;}
在我的页面xaml资源

<CollectionViewSource x:Name="cvs" IsSourceGrouped="true"
                      Source="{Binding Directions}" />

和语义缩放代码:

<SemanticZoom x:Name="semanticZoom">
    <SemanticZoom.ZoomedOutView>
            <GridView ItemsSource="{Binding Path=View.CollectionGroups, Source={StaticResource cvs}}" ScrollViewer.IsHorizontalScrollChainingEnabled="False">
                <GridView.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Direction}"/>
                    </DataTemplate>
                </GridView.ItemTemplate>
                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapGrid />
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
            </GridView>
        </SemanticZoom.ZoomedOutView>
        <SemanticZoom.ZoomedInView>
            <GridView ItemsSource="{Binding Source={StaticResource cvs}}" IsSwipeEnabled="True" ScrollViewer.IsHorizontalScrollChainingEnabled="False">
                <GridView.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" />
                    </DataTemplate>
                </GridView.ItemTemplate>
                <GridView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text='{Binding Direction}' />
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>
                        <GroupStyle.ContainerStyle>
                            <Style TargetType="GroupItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="GroupItem">
                                            <StackPanel Orientation="Vertical">
                                                <ContentPresenter Content="{TemplateBinding Content}" />
                                                <ItemsControl x:Name="ItemsControl" ItemsSource="{Binding Stops}" />
                                            </StackPanel>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </GroupStyle.ContainerStyle>
                    </GroupStyle>
                </GridView.GroupStyle>
                <Button Visibility="Collapsed"/>
            </GridView>
        </SemanticZoom.ZoomedInView>
    </SemanticZoom>


接受任何想法。

我自己也遇到了这个问题,经过一番搜索后找到了解决方案。。对于OP来说可能已经太晚了,但为了其他可能遇到同样问题的人,我还是会发布它

使用
CollectionViewSource
上的
ItemsPath
属性。在网上阅读更多关于它的信息


 <CollectionViewSource 
      x:Name="cvs" 
      IsSourceGrouped="true"
      Source="{Binding Directions}" 
      ItemsPath="Stops" />                    <!-- Add this last bit -->