0
經過多次嘗試運行此功能,最後我絕對失去了。 僅顯示組標題並且僅在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; }
}
視圖模型會員
public ObservableCollection<ScheduleDirection> Directions { 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>
接受任何想法。