我有以下内容,其中白色矩形是GridViewItems,“Abilities”是标题。
如何使标题位于所有列的上方?
简称我的代码:
<GridView Header="Abilities" Margin="0" SelectionMode="None" >
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
</GridView>
答案 0 :(得分:1)
两种选择:
<GridView HorizontalAlignment="Left" Width="400" Height="400" Header="Abilities">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Horizontal" Width="400" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridViewItem/>
<GridViewItem />
<GridViewItem/>
<GridViewItem />
<GridViewItem />
<GridViewItem />
</GridView>
或者
<Grid Width="400" Height="300">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource SubheaderTextStyle}" Text="Abilities" Margin="0 20" />
<GridView Grid.Row="1">
<GridViewItem />
<GridViewItem />
<GridViewItem />
</GridView>
</Grid>
答案 1 :(得分:-1)
尝试将标题放在GridView
<TextBlock Text="Abilities"/>
<GridView Margin ="0" SelectionMode="None" />
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
</GridView>