Hello,
I have a situation where my XamDataGrid objects need to be created dynamically. I'm trying to create a summary definition in code where I want the summary label suppressed (i.e. "234" instead of "Sum = 234").
In XAML, I can accomplish this with a string format of "{}{0:n0}", but my string formats don't seem to have any effect when I move them to code.
For instance, In the FieldLayoutInitialized event handler, I have the code shown below. When the XamDataGrid is displayed, my string format displays as "Sum = 234". Any ideas of how to force my code string format?
Thanks,
Steve
private void XamDataGridOnFieldLayoutInitialized(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs e) { XamDataGrid xamDataGrid = (sender as XamDataGrid); SummaryDefinition summaryDef = new SummaryDefinition() { Key = string.Format("CountItems"), SourceFieldName = "Item", StringFormat = "{}{0:n0}" }; xamDataGrid.DefaultFieldLayout.SummaryDefinitions.Add(summaryDef); }
Hello Steve,
You can set the StringFormat property of SummaryDefinition to StringFormat = "{0:n0}" instead of StringFormat = "{}{0:n0}".
Please let me know if you require any further assistance.
Sincerely, ZhivkoEntry Level Software Developer
That worked perfectly. Thanks!