我正在编写 Windows Phone 8.1应用程序(WinRT)
我使用了内置的Hub模板。我用 pivot 替换了 Hub 。但是gridview中存在的项目不是包装和走出边界。可能会遗漏什么?
旧代码:
<Hub x:Name="Hub"
x:Uid="Hub"
Background="{ThemeResource HubBackgroundImageBrush}">
<Hub.HeaderTemplate>
<DataTemplate>
<TextBlock
Text="KeyTreat"
Style="{StaticResource CategoriesText}"
FontSize="48"
Margin="0,20,0,0">
</TextBlock>
</DataTemplate>
</Hub.HeaderTemplate>
<HubSection x:Uid="HubSectionCategories"
Header="CATEGORIES"
Width="Auto"
Margin="0,0,0,0"
DataContext="{Binding Groups[0]}"
HeaderTemplate="{ThemeResource HubSectionHeaderTemplate}">
<DataTemplate>
<GridView
Margin="0,9.5,0,0"
ItemsSource="{Binding Items}"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Categories in Key Treat"
ItemTemplate="{StaticResource StandardCategoriesItemTemplate}"
SelectionMode="None"
IsItemClickEnabled="True"
ItemClick="ItemView_ItemClick"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</DataTemplate>
</HubSection>
</Hub>
新代码:
<Grid x:Name="LayoutRoot">
<Pivot
x:Uid="Pivot"
Margin="0,0,0,0"
Title="MY APPLICATION"
x:Name="pivot"
CommonNavigationTransitionInfo.IsStaggerElement="True">
<!--Pivot item one-->
<PivotItem
x:Uid="PivotItem1"
Margin="19,14.5,0,0"
Header="first"
Width="Auto"
DataContext="{Binding Groups[0]}"
CommonNavigationTransitionInfo.IsStaggerElement="True"
>
<GridView
Margin="0,9.5,0,0"
ItemsSource="{Binding Items}"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Categories in Key Treat"
ItemTemplate="{StaticResource StandardCategoriesItemTemplate}"
SelectionMode="None"
IsItemClickEnabled="True"
ItemClick="ItemView_ItemClick"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</PivotItem>
</Pivot>
</Grid>
问题是 无效。
答案 0 :(得分:0)
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>