How to bind DataGridColumn.Visibility?

前端 未结 9 1938
悲哀的现实
悲哀的现实 2020-12-10 03:46

I have an issue similar to the following post:

Silverlight DataGridTextColumn Binding Visibility

I need to have a Column within a Silverlight DataGrid be vis

9条回答
  •  醉酒成梦
    2020-12-10 03:53

    Note that the problem isn't just as simple as 'Visibility' not being a dependency property. In a DataGrid the columns aren't part of the visual 'tree' so you can't use AncestorType even in WPF (or Silverlight 5).

    Here's a couple WPF related links (please comment if any of these work for Silverlight - sorry I don't have time to test now)

    Has a really nice explanation of the problem and failures of certain solutions (and a clever solution): http://tomlev2.wordpress.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/

    And a couple StackOverflow questions:

    WPF Hide DataGridColumn via a binding

    Binding Visible property of a DataGridColumn in WPF DataGrid

提交回复
热议问题