Group headers get mixed up
When I'm trying to change the order of grouped columns in the group area, the group headers in the grid get mixed up.
For example:
I group by 2 columns: Status & Mode – Everything looks ok.
When I change the order of the grouping by dragging the 'Mode' label in the group area, the group headers get mixed up, and I get the following groups:
'Status_1'
'Mode_2'
'Status_0'
I think it has to do with the fact that I implemented the Loaded event of the GroupByRecordPresenter.
I did it because I needed to change the text of the group headers.
For starters, by default the group header display the value followed by '(n items)' where n stands for the number of items, and I needed to change that. (I wanted to get rid of the 'items' part).
1. Is there a way to fix this problem?
2. Is there different way to achieve what I wanted (without implementing the Loaded event of the GroupByRecordPresenter)?
I'm attaching a sample that demonstrates the problem.
(To see the problem, group by 2 columns and then switch the order between them).
Hello Hagit,
Thank you for your post!
I have been looking into it and what I can suggest is handling the Grouped event of the XamDataGrid. In the handler of the event you can set the Value of the GroupByRecord as Description. Here is a code snippet, that can be used:
foreach (GroupByRecord rec in theGrid.Records)
{
rec.Description = Convert.ToString(rec.Value);
}
Please note that when you group by two fields you have to iterate though the child records and set the description for them too.
Please do not hesitate to let me know if you have any further questions on this matter.
Thanks for your answer.
As I understand from your answer, I will have to write some code and call it recursively, because the user can group by 2, 3, and more fields. So, after I change the description of the GroupByRecordPresenter instance, how do I get to its GroupByRecordPresenterCollection children?
I have been looking into your question.
What I can suggest is to take a look at the following link from our documentation, where you can find more information about iterating through the different types of records in the XamDataGrid: http://help.infragistics.com/Help/Doc/WPF/2012.1/CLR4.0/html/xamDataPresenter_Iterate_through_the_Records_Collection.html
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.