由于某种原因,我无法隐藏 WPF Toolkit 的 DataGridColumn。我正在尝试执行以下操作:
<dg:DataGridTemplateColumn Header="Item Description" Visibility="{Binding IsReadOnly}">
<dg:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=ItemDescription}" />
</DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
这不起作用,因为它在 ItemSource 上寻找 IsReadOnly 属性(不是当前类的属性)。如果将此添加为实现 INoifyPropertyChanged 的 ItemSource 类的属性,它仍然不会隐藏该列。有没有解决的办法?当按钮单击更改 IsReadOnly 属性时,我希望该列隐藏。
假设 IsReadOnly 返回一个 Visibility 值并且是一个依赖属性
我完全被卡住了,我非常感谢您的帮助!非常感谢!