windowsforms-114630-controls-and-libraries-data-grid-getting-started-walkthroughs-summaries-tutorial-format-summary-text.md
This walkthrough is a transcript of the Format Summary Text video available on the DevExpress YouTube Channel.
In this tutorial, you will learn how to add custom text to summary values, what kind of value formatting is applied to summaries by default, how to change numeric value formatting using an example of a total summary, and how to change formatting for date-time values using an example of group summaries.
Start with a GridControl that has a footer enabled.
To learn more about available numeric format specifiers, refer to the Standard Numeric Format Strings topic in MSDN.
gridView.Columns["MyColumn"].SummaryItem.Format = new MyFormat();
public class MyFormat : IFormatProvider, ICustomFormatter {
public string Format(string format, object arg, IFormatProvider formatProvider) {
// Convert argument to a string.
string result = arg.ToString();
// Format the result as needed.
// ...
return result;
}
public object GetFormat(Type formatType) {
if (formatType == typeof(ICustomFormatter))
return this;
else
return null;
}
}
Read the following topic for detailed information: IFormatProvider Interface.
See Also
Tutorial: Obtain Summary Values
Tutorial: Sort Group Rows by Summary Values
Tutorial: Custom Summary Functions