我有一个应用程序,它的主页面组织如下:
网格(LayoutRoot)
VisualStateManager (FullLandscape, FullPortrait, Filled, Snap)
Grid (Back button and page title)
ScrollViewer (FullLandscape View )
StackPanel (Horizontal)
GridView (non grouped GridView)
GridView (grouped GridView)
GridView (non grouped GridView)
GridView (grouped GridView)
GridView (grouped GridView)
ScrollViewer (Snap View)
Grid
ListView (Vertical)
我的问题是:
我是否必须为应用程序中的每个页面提供SemanticZoom,以便应用程序通过认证?
如果我想为此主页提供SemanticZoom,我该怎么做?即我在哪里插入SemanticZoom控件?
(我读过文章:快速入门:添加SemanticZoom控件:)
<SemanticZoom.ZoomedOutView>
<!-- Put the GridView for the zoomed out view here. -->
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
<!-- Put the GridView for the zoomed in view here. -->
</SemanticZoom.ZoomedInView>
谢谢, EitanB
答案 0 :(得分:3)
从您上面所写的内容中了解您要实现的目标有点困难,但我会尽力回答您的问题。
1) SemanticZoom的使用并非强制要求通过认证。这是一个很好的功能,可以帮助您以一种干净利落的方式向用户呈现数据,并且在适当使用时非常酷。 但是,它只是一个控制。向我们提供有关您的项目的更多信息,也许我们可以帮助您确定是否会为应用程序添加额外的内容。 轻松入门,稍后再详细介绍。
2) Download the SemanticZoom example from MSDN并查看代码。基本上它看起来像这样:
<Page.Resources>
<CollectionViewSource x:Name="cvs2" IsSourceGrouped="true" />
</Page.Resources>
<Grid x:Name="ContentPanel" VerticalAlignment="Top" HorizontalAlignment="Left">
<SemanticZoom x:Name="semanticZoom" VerticalAlignment="Bottom">
<SemanticZoom.ZoomedOutView>
<GridView ScrollViewer.IsHorizontalScrollChainingEnabled="False">
<GridView.ItemTemplate>
<DataTemplate>
<TextBlock
Text="{Binding Group.Key}"
FontFamily="Segoe UI Light"
FontSize="24"/>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid ItemWidth="75" ItemHeight="75" MaximumRowsOrColumns="1" VerticalChildrenAlignment="Center" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="Margin" Value="4" />
<Setter Property="Padding" Value="10" />
<Setter Property="BorderBrush" Value="Gray" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</GridView.ItemContainerStyle>
</GridView>
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
<GridView ItemsSource="{Binding Source={StaticResource cvs2}}" IsSwipeEnabled="True" ScrollViewer.IsHorizontalScrollChainingEnabled="False">
<GridView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="10,10,0,0" HorizontalAlignment="Left" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Image Source="{Binding Image}" Height="60" Width="60" VerticalAlignment="Center" Margin="0,0,10,0"/>
<TextBlock TextWrapping="Wrap" Foreground="{StaticResource ApplicationForegroundThemeBrush}" Width="200" VerticalAlignment="Center" Text="{Binding Title}" HorizontalAlignment="Left" FontFamily="Segoe UI" />
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock Text='{Binding Key}' Foreground="{StaticResource ApplicationForegroundThemeBrush}" Margin="5" FontSize="18" FontFamily="Segoe UI Light" />
</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 GroupItems}" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
<GroupStyle.Panel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Vertical" MaximumRowsOrColumns="3" />
</ItemsPanelTemplate>
</GroupStyle.Panel>
</GroupStyle>
</GridView.GroupStyle>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Vertical" MaximumRowsOrColumns="1" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<Button Visibility="Collapsed"/>
</GridView>
</SemanticZoom.ZoomedInView>
</SemanticZoom>
</Grid>
和codebehind:
StoreData _storeData = null;
public ScenarioOutput1()
{
InitializeComponent();
_storeData = new StoreData();
List<GroupInfoList<object>> dataCategory = _storeData.GetGroupsByCategory();
cvs1.Source = dataCategory;
}
答案 1 :(得分:0)
感谢您的回答。
我确实看到了这个例子,我很清楚。我不清楚的是:我在这一页上有多个GridView,而不仅仅是一个例子中的一个。我脑海中浮现的问题是:我应该按照页面上每个GridView的示例代码,还是有办法为覆盖所有GridView的页面执行一次?请参阅下面的伪代码。
谢谢, EitanB
VisualStateManager(FullLandscape,FullPortrait,Filled,Snap)
网格(后退按钮和页面标题)
ScrollViewer(FullLandscape View)
StackPanel (Horizontal)
<SemanticZoom x:Name="semanticZoom1" VerticalAlignment="Bottom">
<SemanticZoom.ZoomedOutView>
GridView (non grouped GridView)
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
GridView (non grouped GridView - Semantic Version)
</SemanticZoom.ZoomedInView>
</SemanticZoom>
<SemanticZoom x:Name="semanticZoom2" VerticalAlignment="Bottom">
<SemanticZoom.ZoomedOutView>
GridView (grouped GridView)
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
GridView (grouped GridView - Semantic Version)
</SemanticZoom.ZoomedInView>
</SemanticZoom>
<SemanticZoom x:Name="semanticZoom3" VerticalAlignment="Bottom">
<SemanticZoom.ZoomedOutView>
GridView (non grouped GridView)
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
GridView (non grouped GridView - Semantic Version)
</SemanticZoom.ZoomedInView>
</SemanticZoom>
<SemanticZoom x:Name="semanticZoom4" VerticalAlignment="Bottom">
<SemanticZoom.ZoomedOutView>
GridView (grouped GridView)
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
GridView (grouped GridView - Semantic Version)
</SemanticZoom.ZoomedInView>
</SemanticZoom>
<SemanticZoom x:Name="semanticZoom5" VerticalAlignment="Bottom">
<SemanticZoom.ZoomedOutView>
GridView (grouped GridView)
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
GridView (grouped GridView - Semantic Version)
</SemanticZoom.ZoomedInView>
</SemanticZoom>
ScrollViewer(Snap View)
Grid
ListView (Vertical)
答案 2 :(得分:0)
这样做的方式就像我在我的问题中发布的那样,即问题是询问它是否正确,答案是肯定的。
EitanB