1

私はGridViewを持っています:

<GridView HorizontalAlignment="Left" Width="400" Height="400" Header="AAAAAA">
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
        </GridView>

ここに画像の説明を入力してください

私は単に、GridViewItemの位置に介在する左側ではなく、GridViewの上部にAAAAAが必要です。ご存知のとおり、Windows 8の音楽アプリのように、「現在再生中>」または「最も人気のある>」というタイトルがGridViewの上部に配置されています。どうやってするの?

4

4 に答える 4

1

これを試して:

    <GridView HorizontalAlignment="Left" Width="400" Height="400" Header="AAAAA">
        <GridView.ItemsPanel>
            <ItemsPanelTemplate>
                <VariableSizedWrapGrid Orientation="Horizontal" Width="400" />
            </ItemsPanelTemplate>
        </GridView.ItemsPanel>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
    </GridView>

または、GridViewのヘッダーを使用する代わりに、次のようにすることもできます。

    <Grid Width="400" Height="300">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock Style="{StaticResource SubheaderTextStyle}" Text="My Header" Margin="0 20" />
        <GridView Grid.Row="1">
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
            <GridViewItem Content="GridViewItem" Margin="0"/>
        </GridView>
    </Grid>
于 2012-12-02T13:25:05.300 に答える
0

これを試して:

<GridView HorizontalAlignment="Left" Width="400" Height="400">
        <GridView.Header> <TextBlock Text="AAAAA" Margin="240,0,0,0"/>
        </GridView.Header>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
    </GridView>

TextBlockに必要なプロパティを設定できます

于 2012-12-02T12:59:36.987 に答える
0
<GridView HorizontalAlignment="Left" Width="400" Height="400" Header="AAAAA">
        <GridView.ItemsPanel>
            <ItemsPanelTemplate>
                <VariableSizedWrapGrid Orientation="Horizontal" Margin="-80,20,0,0" Width="400" />
            </ItemsPanelTemplate>
        </GridView.ItemsPanel>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
        <GridViewItem Content="GridViewItem" Margin="0"/>
    </GridView>

Or you can adjust the margin of the variableSizedWrapGrid, so that the alignment of the header and Items should appear in same line
于 2013-10-23T11:35:06.290 に答える
0

<-これを試してください->

<GridView HorizontalAlignment="Left" Width="400" Grid.Row="1" Height="400">
<GridView.Header>
<TextBlock Text="AAAAA" />
</GridView.Header>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Margin="-35,20,0,0"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
<GridViewItem Content="GridViewItem" Margin="0"/>
</GridView>
于 2013-10-29T12:54:23.950 に答える