I am using XamDataGrid/WPF to present a hierarchical view of a dataset.
The dataset starts out with a set of sums for a whole years, and can be drilled down into weeks and then eventually the details for each week.
Although the feature of headers sticking to the top when scrolling is nice in general, it works particulary badly for this scenario.
I get up to four layers of headers sticking to the top of my view before the selected level of detail is displayed.
Please see the attached image to get an idea.
In short: The headers are wanted, the sticky headers are not.
How can this be achieved?
Best Regards
Tommy Wendelborg
Hello Tommy,
Currently the XamDataGrid is designed to worked on that way. In order to control the location of the labels you can use LabelLocation property, the modes are:
Hidden - Don't show labels InCells - Show labels inside the cells SeparateHeader - Show labels in a separate header
You can try the InCells mode, this way the headers will be scrolled with the rest of the content.
Let me know if you need from further assistance.
Sincerely,Zhivko
Thank you for your reply, it is however not answering the intended question.
To be more precise:
I do want all headers to be visible, but I also want them to scroll away with the rest of the content.
What I especially don't want is all the headers to gather themselves in the top of the XamDataGrid like it does now (see the picture coming with the initial post).
Headers visible, not sticky. Like a normal Excel-spreadsheet with labels at the top.
Thanks for helping out,
Tommy
You can use the LabelLocation property to set location of the labels for each FieldLayout. You can set it xaml or code behind:
XAML:Define the layouts manually in xaml and set it for the layouts you wish:
<igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings LabelLocation="Hidden" /></igDP:XamDataGrid.FieldLayoutSettings><igDP:XamDataGrid.FieldSettings>
Code: For example handle the FieldLayoutInitialized event and check the e.FieldLayout.Key to determine whether it is equal to the layout's Key in which you wish to hide the labels:
private void xdg_FieldLayoutInitialized(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs e{ if (e.FieldLayout.Key.ToString() == "Parent" || e.FieldLayout.Key.ToString() == "Children") { e.FieldLayout.Settings.LabelLocation = LabelLocation.Hidden; }}
I have attached a simple project where you can test this approach.
Please let me know if you need more information.
Sincerely,ZhivkoAssociate Software Developer