Hi,
how to remove the "(x items)" suffix in the Group Header Label?
Regards,
Christoph
Hello,
The text for the label of the GroupByRecord is actually the description of the row. What I can recommend you is using a recursion that checks whether the row is a GroupByRow and if it is, it should change the description to remove the "(x items)" suffix with the help of Substring.
This recursion should be called inside the Grouped event of the grid. If there are grouped fields when loading the grid the same code should be placed inside the Loaded event of the grid.
Below I am pasting the code for the Grouped event as well as the recursion for changing the description:
private void xamDataGrid1_Grouped(object sender, Infragistics.Windows.DataPresenter.Events.GroupedEventArgs e) { for (int i = 0; i < this.xamDataGrid1.Records.Count; i++) { changeDescription(this.xamDataGrid1.Records[i]); } } public void changeDescription(Record record) { if (record is GroupByRecord) { int endIndex = record.Description.IndexOf(" "); if (endIndex >= 0)record.Description = record.Description.Substring(0, endIndex); GroupByRecord gr = record as GroupByRecord; if (gr.HasChildren) { for (int i = 0; i < gr.ChildRecords.Count; i++) { changeDescription(gr.ChildRecords[i]); } } } else return; }
I am also attaching a small sample that demonstrates what I have explained above.
Please test it on your side and let me know if have any questions.
Regards, Ivan Kitanov
GroupByRecordRemoveNumberOfRecordsFromDescription.zip