Bind DataGridTemplateColumn Visibility

data-binding, datagrid, datagridtemplatecolumn, mvvm

Solution

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...

Problem

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) ?

Original source

Related problems