wpfwpf-4.0

How to get Path of Binding of a DataGridBoundColumn


I have a simple datagrid to which I am binding a collection using ItemsSource. In my c# code I wan't to retrieve binding path of a column. I have reference to the column. Here is the non-working code that I have put up

DataGridBoundColumn column = getColumn() //function to get column. Already working
BindingBase binding = column.Binding;  //get the binding
PropertyPath path = //how to get the path from binding.

Solution

  • You need to downcast to "Binding". Then you can access the path.