Retrieve Original Column Header, Post Binding

Jan 10, 2009 at 1:19 AM
In my data grid column definition, I have defined the data binding, but I have also changed the header text (see example below).

<dg:DataGrid Name="myGrid">
     <dg:DataGridTextColumn Header="Created On" Width="135" Binding="{Binding WhenCreated}" IsReadOnly="True"/>
     <dg:DataGridTextColumn Header="Created By" Width="135" Binding="{Binding CreatedByUser}" IsReadOnly="True"/>
     <dg:DataGridTextColumn .../>
     <dg:DataGridTextColumn .../>
</dg:DataGrid Name="myGrid">

I have the header values populating a combobox which drives grouping and filtering.  When the grouping or filtering needs to be applied, the combo box returns me a DataGridTextColumn based on my selection.  The column.Header has the modified header value (e.g. "Created On") and not the original bound value WhenCreated.  That is to be expected.  But how do I go about retrieving the data binding information for the column?

Assuming my data column instance is 'c', I tried getting the Binding as follows:
         Binding myBinding = BindingOperations.GetBinding(c, DataGridColumn.?????);

But what DependencyProperty of the DataGridColumn do I want? 

Thanks for the help.
Jan 12, 2009 at 1:02 PM
Try DataGridBoundColumn.BindingProperty.
Jan 12, 2009 at 6:56 PM
Thanks very much, Vincent - that got me what I needed.

    Binding b = (Binding)((DataGridBoundColumn)c).Binding;
    PropertyPath path = b.Path;
    string p = path.Path;   // p has the original column/element name I needed