Howdy!
I need help styling the XamDataGrid header row in the attached project.
I'd like a popup toolbar on the left of the header row so a user can show/hide the filter row, clear all sorting, and perhaps use a few predefined header formats.
For the life of me, I cannot figure out the right thing to style.
I'd like to add the graphic that triggers the popup on the left of the header before the "view" column: , right where the arrow is pointing.
I can't figure out the right thing to style to add my popup toolbar and keep everything aligned.
Any help would be greatly appreciated.
The project is attached.
4338.WpfApp1.zip
Hello Douglas,
I have been investigating into your requirement to place a custom part in the “pre-header” area of the XamDataGrid, and from your sample project, it looks like you are already actually styling the element that I was going to recommend – the HeaderPrefixArea. There appears to be an issue with the XamDataGrid at the moment that if you set the XamDataGrid.FieldLayoutSettings.RecordSelectorLocation property to “None,” that removes the HeaderPrefixArea as well, and this is currently set in your application. I do not believe this is expected, and as such will be discussing this with our development teams.
If you still do not want the RecordSelector to appear, the best thing I can recommend at the moment is actually to modify the default template of the DataRecordPresenter, and this is demonstrated in the modified version of the sample that I am attaching. There are a couple of pieces that I added to the template, namely:
<Rectangle x:Name="preHeaderRect" Height="12" Width="12" Fill="Blue" Grid.Row="1"/>
<Trigger Property="IsHeaderRecord" Value="False"> <Setter TargetName="preHeaderRect" Property="Visibility" Value="Collapsed" /> </Trigger>
You should see a blue Rectangle in the top left of your grid ahead of the headers with this addition. If you place a Grid with your elements inside where this Rectangle exists, you should be able to achieve the behavior you are looking for. Alternatively, if you keep the RecordSelector visible, this will allow the HeaderPrefixArea re-template to show.
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
0743.WpfApp1.zip