小编tor*_*jue的帖子

更改GridView标题放置

我有一个普通的GridView,它显示分组数据.我的目标是将标题(按钮)从组顶部移动到组的左侧.

<GridView>
    <GridView.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
    </GridView.ItemsPanel>

    <GridView.GroupStyle>
        <GroupStyle>
            <GroupStyle.HeaderTemplate>
                <DataTemplate>
                    <Grid>
                        <Button Content="{Binding Title}"/>
                    </Grid>
                </DataTemplate>
            </GroupStyle.HeaderTemplate>
            <GroupStyle.Panel>
                <ItemsPanelTemplate>
                    <VariableSizedWrapGrid ItemWidth="240" ItemHeight="160" Orientation="Vertical" Margin="0,0,80,0"/>
                </ItemsPanelTemplate>
            </GroupStyle.Panel>
        </GroupStyle>
    </GridView.GroupStyle>

    <GridView.ItemTemplate>
        <!-- item template -->
    </GridView.ItemTemplate>
</GridView>
Run Code Online (Sandbox Code Playgroud)

这个问题的答案在Windows 8 Metro App中GridView进行分组 - 虽然不是完全相同的所需布局 - 但如果不添加额外的"虚拟磁贴",则无法实现所需的布局.

我想知道是否有可能实现我的目标 - 将标题从组的顶部移动到组的左侧 - 没有这样一个额外的"虚拟磁贴".

c# xaml gridview microsoft-metro windows-runtime

5
推荐指数
1
解决办法
3620
查看次数

标签 统计

c# ×1

gridview ×1

microsoft-metro ×1

windows-runtime ×1

xaml ×1