Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PivotGridControl.HtmlImages Property

Gets or sets a collection of images which can be used in HTML string displayed in the field headers or values.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v24.2.dll

NuGet Package: DevExpress.Win.PivotGrid

#Declaration

[DefaultValue(null)]
[DXCategory("Appearance")]
public virtual object HtmlImages { get; set; }

#Property Value

Type Default Description
Object null

An image collection (DevExpress.Utils.ImageCollection or DevExpress.Utils.SvgImageCollection).

#Remarks

To insert an image in an HTML string displayed in field values or field headers:

#Example

This code snippet demonstrates how to handle the PivotGridControl.FieldValueDisplayText event to dispklay HTML in field values.

Tip

The live example HTML in Field Values is available in our demo center.

pivotgridcontrol-html-formatting

pivotGridControl.HtmlImages = DemoHelper.GetHtmlImages();
pivotGridControl.OptionsView.AllowHtmlDrawFieldValues = true;
pivotGridControl.FieldValueDisplayText += (sender, args) => {
    if(!args.IsPopulatingFilterDropdown && args.ValueType == PivotGridValueType.Value && args.Field.FieldName == "ProductName") {
        int categoryID = (int)args.CreateDrillDownDataSource().GetValue(0, "CategoryID");
        string prefix = string.Format("<image={0}> ", categoryID);
        string foreColor = DemoHelper.GetCategoryColor(categoryID);
        if(!string.IsNullOrEmpty(foreColor))
            prefix += string.Format("<color={0}>", foreColor);
        args.DisplayText = prefix + args.DisplayText;
    }
};
See Also