GridOptionsView.AllowHtmlDrawGroups Property
Gets or sets whether HTML tags can be used to format text in group rows.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v23.2.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
[DefaultValue(true)]
[XtraSerializableProperty]
public virtual bool AllowHtmlDrawGroups { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | true | true if HTML tags can be used to format text in group rows; otherwise, false. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to AllowHtmlDrawGroups |
---|---|
GridView |
|
Remarks
You can format text in group rows via the GridView.CustomDrawGroupRow event. To supply the new text for group rows, cast the event’s e.Info object to the GridGroupRowInfo object and then set the GridGroupRowInfo.GroupText property to the required value.
The HTML Text Formatting topic covers HTML tags you can use to format text.
Another way to format text in group rows is to use the GridView.GroupFormat property.
Example
The following example shows how to use HTML tags to format text in group rows via the GridView.CustomDrawGroupRow event. In the example, when data is grouped by the Quantity column, the column’s group values are painted in different colors using the <color> tag.
New display text for group rows is supplied via the GroupText property of the event’s e.Info parameter.
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
gridView1.OptionsView.AllowHtmlDrawGroups = true;
private void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e) {
GridView view = sender as GridView;
GridGroupRowInfo info = e.Info as GridGroupRowInfo;
if (info.Column.Caption == "Quantity") {
int quantity = Convert.ToInt32(view.GetGroupRowValue(e.RowHandle, info.Column));
string colorName = getColorName(quantity);
info.GroupText = info.Column.Caption + ": <color=" + colorName + ">" + info.GroupValueText + "</color> ";
info.GroupText += "<color=LightSteelBlue>" + view.GetGroupSummaryText(e.RowHandle) + "</color> ";
}
}
string getColorName(int value) {
if (value < 20) return "MediumOrchid";
if (value >= 80) return "OrangeRed";
return "Blue";
}