Is there any way how to override DataGrids header line ? Or at least its behaviour ? I’m trying to implement Outlook-like grouping of the table. That is allow user to drag column header out of the table to the dedicated area to sort by that column (for example XamDataGrid has that feature, you can see how it works here).
I cannot use any commercial solutions.
I will be thankfull for any experiences, ideas, code, notes or tutorials.
EDIT: According to some posts I was able to find, I should replace DataGridColumnsHeaderPresenter in the DataGrid to be able to do what I desire. I have never done anything like that, I have no idea where to start. OK I write my own DataGridColumnsHeaderPresenter that will be composed of original DataGridColumnsHeaderPresenter and some other components and what then? How do I get my DataGrid to use the new DataGridColumnsHeaderPresenter instead of default one ? Please provide code if possible.
Put this in your resources change the part surrounded by ** to:
Declare your grid in xaml like this:
Notice the stack panel with the buttons you can put whatever you want over there.
Hope this helps
If you want to change the DataGridColumnsHeaderPresenter I would do it like this.
This is the default template for the presenter:
I would change it to something like this:
Here is the style for the default DataGrid