Bind DataGridTemplateColumn Visibility
Asked Answered
S

1

3

I am trying to bind the visibility of a column in a datagrid to a boolean DependencyProperty in the ViewModel (Set as data context of the View - UserControl in this case). For some reason (I don't seem to understand) it just doesn't work.

After looking here I found out that the datagridtemplate (and any other template) is not part of the visual tree. So I can't bind to it.

Any simple solution to the problem (without breaking the MVVM pattern of course) ?

Ser answered 31/10, 2011 at 14:46 Comment(2)
Is it the problem with binding like its not hitting or you are just setting it to true or false. You might need a Converter for that.Mantel
Does this answer your question? Binding Visibility for DataGridColumn in WPFFragrant
S
3

Found the solution here:
http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/
For future quenstions...

Ser answered 30/3, 2012 at 10:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.