I am using a DataGrid with AutogenerateColumns set to true.
I’m binding it to a weakly-typed DataTable via its DataContext property.
The problem I’ve run into is that all the headers must have unique names, because myGrid.Columns[x].Header value is tied directly to the column name of the underlying DataTable (where, obviously, no duplicate column names are allowed).
Is there any sensible workaround?
Following code is untested…
For DataGridHeaders to be changed, you would have to override their ContentTemplate.
In the above code DynamicColumnHeaderTextConverter’s Convert() method will receive 2 values
Based on this return the non-unique names.
Let me know if this helps.