Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1425
XamDataGrid, binding Header label to nested view model
posted

I am using WPF XamDataGrid, 2012.1 in .NET 4.0. I need to change the text in the column headers of the grid based on at least one, sometimes 2 and 3 properties contained in a nested viewmodel. The datacontext of the main form is the view model, "MainViewModel". The datacontext of the data grid is "CurrentCase.Segments", where Segments is an Observable collection. The MainViewModel contains a public property  called "CurrentCase", which is an instance of a "Case", which is a class containing the properties which determine how to display the data grid header labels. Segments is an ObservableCollection property contained in the Case class.

So, basically I need bind the label of the header as such:

Label="{Binding CurrentCase, Path=IsCircularPipeEnabled", Converter=headerConverter, ConverterParameter='{0} Diameter'}"

The converter and converter parameter combine to test the value of the bool IsCircularPipeEnabled and supply a value for the {0} placeholder used in String.Format.

I've looked at many examples and posts, but can't seem to find one that works.

Can you offer any example or suggestions on how to acheive this?