0

我有以下内容,其中白色矩形是 GridViewItems,“能力”是标题。

白色矩形是 GridViewItems,“能力”是标题

如何使标题位于所有列之上?

简而言之,我的代码:

<GridView Header="Abilities" Margin="0" SelectionMode="None" >
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
<GridViewItem></GridViewItem>
</GridView>
4

2 回答 2

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>
于 2012-12-23T19:09:01.750 回答
-1

试着把你的标题放在外面GridView

<TextBlock Text="Abilities"/>

<GridView Margin ="0" SelectionMode="None" />
    <GridViewItem></GridViewItem>
    <GridViewItem></GridViewItem>
    <GridViewItem></GridViewItem>
    <GridViewItem></GridViewItem>
    <GridViewItem></GridViewItem>
</GridView>
于 2012-12-23T18:36:56.097 回答