Hi
Attached SummaryCellsTextOverlap.zip has source code files and also has GroupTextOverlap.PNG for existing and expected results.
I am trying to do sum aggragation on ID and group by on Abbreviation colums. Right now in result, Abbreviation group by text is overlaping other summary cells (IDName and ID).
Is there a way to fit the group by text in the first cell?. Check GroupTextOverlap.PNG for expected result.
Can you modify the attached source with solution and post in this.
Thanks in advance.
Thanks. That was helpful.
I did not realize that truncate is firing even group by not exist. I've put in code to fire only if group by exist.
Also as we are resetting description in truncate, we can set " " for blank description to avoid "(item)" or "(items)" text. Now I can remove ContentControl_Loaded code and comment Description = " " code in AbbreviationSortComparer. (this will gain some performance).
Hello,
Thank you for your post. I have been looking into it and the code you have provided and I modified it and created a sample project for you with the functionality you want. Basically I moved the logic for truncation in a separate function and called that function after the new data source is loaded. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
How to fire the column resize when grid datasource got new data?
Attached file has the code and image (for expected result) files.
1. Run the code. This will load grid data.
2. Group by Abbreviation column.
3. Group by records will have truncated data (with ...) to fit in cell. Data will truncate/expand when we re-size the Abbreviation column.
4. Hit "Load New Data" button (which is on top) to set new data to the grid without changing the grid columns or layout.
5. Now grid has new data but the Group by Row text is not truncating (as the column re-sizing not firing).
Can you make changes to the code and upload back with the fix.
Thanks for the response.
Now I am able to do truncate for nested group by. Code is using group value (instead of tag value). Attached zip has the modified code (might be helpful for others) and result snapshot.
Hi,
For the nested levels of GroupBy records I would use a recursive logic to retrieve the child records and apply the same concept of truncating the labels. As far as maintaining the initial value, Tag is fine or a string field in code. Here is an example of truncating the labels in nested GroupBy records.
1. In the event the first call to TruncateGroupByLabels() method is for the first GroupBy record.
2. After that I call a method for recursive execution using the child records.
void OnColumnSizeChanged(object sender, SizeChangedEventArgs e)
{
foreach (Record item in xamDataGrid1.Records)
// Truncate the labels on GroupBy records
TruncateGroupByLabels(item);
// In case the GroupBy records have nested GroupBy records
if (item.HasChildren)
GetChildGroupByRecords(item);
}
// Execute recursively to retrieve all GroupBy records and set the labels
public void GetChildGroupByRecords(Record record)
foreach (Record rec in record.ViewableChildRecords)
if (rec.HasChildren)
GetChildGroupByRecords(rec);
TruncateGroupByLabels(rec);
public void TruncateGroupByLabels(Record record)
GroupByRecord groupRec = record as GroupByRecord;
if (groupRec != null)
if (groupRec.GroupByField.LabelWidthResolved < 99)
record.Description = "Truncated...";
else
record.Description = "Here is GroupBy record's description";
I hope this helps. Let me know if you have any questions.
Sam