【问题标题】:WPF DataGrid Row Header is invisibleWPF DataGrid 行标题不可见
【发布时间】:2018-01-06 07:52:43
【问题描述】:

我有 WPF-MVVM 数据网格。我想使用行标题但它是不可见的。 我尝试用 RowHeaderWidth 设置它,但它没有任何效果。 以下是我的代码:

<Grid DataContext="{Binding Tours}">
  <DataGrid Grid.Row="0"
    x:Name="tourDataGrid" 
    RowHeaderWidth="27"
    ItemsSource="{Binding}" 
    AutoGenerateColumns="False"
    Height="360">

怎么了?

提前非常感谢...

【问题讨论】:

  • 也许,您的商品来源为空?
  • 没有。它不是空的。
  • 删除 AutoGenerateColumns="False" 你会看到你的项目

标签: wpf mvvm datagrid rowheader


【解决方案1】:

试试这个:

<Grid DataContext="{Binding Tours}">
   <DataGrid Grid.Row="0"
    x:Name="tourDataGrid" 

    HeadersVisibility="All"

    RowHeaderWidth="27"
    ItemsSource="{Binding}" 
    AutoGenerateColumns="False"
    Height="360">

【讨论】:

  • 谢谢,它有效。我的错误是我在 VS 设计器中没有看到行标题,并且我认为在运行时它也不存在。
猜你喜欢
  • 2012-01-30
  • 1970-01-01
  • 1970-01-01
  • 2010-12-07
  • 2014-10-30
  • 2010-10-14
  • 1970-01-01
  • 2011-02-27
  • 2011-04-28
相关资源
最近更新 更多