Skip to main content

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.v24.2.dll

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
.OptionsView .AllowHtmlDrawGroups

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 e.Info.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 uses HTML tags to format text within group rows. The example handles the CustomDrawGroupRow event. In the example, when data is grouped by the “Quantity” column, group values are painted in different colors using the <color> tag. New display text for group rows is supplied via the e.Info.GroupText property.

GroupRows-HTML-tags-via-CustomDraw

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";
}
See Also