【问题标题】:How to show listview horizontally in WPF?如何在 WPF 中水平显示列表视图?
【发布时间】:2010-12-01 10:03:42
【问题描述】:

如何在行而不是列中显示标题并绑定数据。这样所有绑定的值都会增加列数而不是行数。

ListView.View 设置为 GridView。

请帮忙。

谢谢,

【问题讨论】:

  • 主持人注意的标志是用于管理支持,而不是用于获取紧急问题的答案。

标签: wpf listview layout


【解决方案1】:

我想不出复杂的东西,但你可以试试这个简单的技巧:旋转网格的标题和单元格的内容。谁知道呢,也许这就是你要找的东西:)。

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
   <Grid>
      <ListView>
         <ListView.LayoutTransform>
            <RotateTransform Angle="-90"/>
         </ListView.LayoutTransform>
         <ListView.View>
            <GridView>
               <GridViewColumn Header="First">
                  <GridViewColumn.CellTemplate>
                     <DataTemplate>
                        <ContentPresenter Content="{Binding}">
                           <ContentPresenter.LayoutTransform>
                              <RotateTransform Angle="90"/>
                           </ContentPresenter.LayoutTransform>
                        </ContentPresenter>
                     </DataTemplate>
                  </GridViewColumn.CellTemplate>
               </GridViewColumn>               
            </GridView>
         </ListView.View>
         <TextBlock Text="Some Data"/>
         <TextBlock Text="More Data"/>
      </ListView>
   </Grid>
</Page>

【讨论】:

    猜你喜欢
    • 2020-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多