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

Declaration

[DefaultValue(true)]
[XtraSerializableProperty]
public virtual bool AllowHtmlDrawGroups { get; set; }
<DefaultValue(True)>
<XtraSerializableProperty>
Public Overridable Property AllowHtmlDrawGroups As Boolean

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

Examples

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.

GroupRows-HTML-tags-via-CustomDraw

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