This should work:
<DataGridTextColumn Visibility="{Binding Path=DataContext.Foo, RelativeSource={RelativeSource AncestorType=DataGrid}}" />
You're right about the column being bound to the current item - that's why you need to use RelativeSource
to get the DataGrid, and then access the Foo
property in its DataContext
.
As for selecting the property to bind to, there's the WPF designer's properties panel and visual studio addons such as Resharper which can help, but eventually they don't do such a great job at anything other than simple bindings, so what you're left with is yourself and your understanding of what's going on.