Is there any way that I could hide summary row (i.e. because of binding to boolean property or binding to a collection)? Any help appriciated!
Hello cero,
Please refer to the following help topic for information on enabling (and disabling) row summaries.
Enable Row Summaries
It mentions that you can set the AllowSummaries property on a specific Field.FieldSettings, which will override the setting on the XamDataGrid.FieldSettings.
Elizabeth AlbertLocalization Engineer
But this functionality only allows user to enable\disable summaries manually. In fact my requirement is to make visible\unvisible additional summary row under specific circumstances.
You can set the AllowSummaries property to False through code if the Field matches your condition.
The problem is that I have already SummaryDefinitions collection filled, so setting AllowSummaries to false doesn't change anything it is still visible. The most convinient way to fill requirement would be to bind SummaryDefinitions collection and clear\fill collection when needed.
Before attempting a custom dependency property, I just want to check with you whether a more simplistic approach might work; namely to store the collection of SummaryDefinitions in a variable so it can be cleared from and restored to the FieldLayout as needed.
The attached sample demonstrates this approach. It works in this simple case with a single FieldLayout.
if (xamDataGrid1.FieldLayouts[0].SummaryDefinitions.Count > 0) { this.xamDataGrid1.FieldLayouts[0].SummaryDefinitions.Clear(); } else { foreach (SummaryDefinition def in SummColl) { this.xamDataGrid1.FieldLayouts[0].SummaryDefinitions.Add(def); } }
Hello,
Did this approach work for you? Please let me know if you have further questions.
Thanks,
Yes it worked very well!
But in my case requirement was satisfied with simple manipulating SummaryDisplayArea property:
FieldSettings.SummaryDisplayArea = SummaryDisplayAreas.None
Thank you very much for your help!