使用 itemssource 从数据网格中删除第一列
remove 1 colum from a datagrid using item source
我有一个数据网格,它有一个 observablecollection 的项目源,我想将 1 列保存在 observablecollection 中,而不是在数据网格中向用户显示。
我该怎么做?
你可以像这样在后面的代码中隐藏Column
:
YourDataGrid.Columns[IndexOftheColumn].Visibility = Visibility.Collapsed;
或者,如果您希望它仅 xaml,您应该将 AutoGenerateColumns
设置为 False
并在 Xaml
.[=15= 中定义自定义列]
我有一个数据网格,它有一个 observablecollection 的项目源,我想将 1 列保存在 observablecollection 中,而不是在数据网格中向用户显示。
我该怎么做?
你可以像这样在后面的代码中隐藏Column
:
YourDataGrid.Columns[IndexOftheColumn].Visibility = Visibility.Collapsed;
或者,如果您希望它仅 xaml,您应该将 AutoGenerateColumns
设置为 False
并在 Xaml
.[=15= 中定义自定义列]