Back to Devexpress

GridOptionsView.AllowHtmlDrawHeaders Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridoptionsview-84839696.md

latest4.7 KB
Original Source

GridOptionsView.AllowHtmlDrawHeaders Property

Gets or sets whether HTML formatting can be applied to column and band captions.

Namespace : DevExpress.XtraGrid.Views.Grid

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(false)]
[XtraSerializableProperty]
public virtual bool AllowHtmlDrawHeaders { get; set; }
vb
<DefaultValue(False)>
<XtraSerializableProperty>
Public Overridable Property AllowHtmlDrawHeaders As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true if HTML formatting can be applied to column and band captions; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to AllowHtmlDrawHeaders
GridView

.OptionsView .AllowHtmlDrawHeaders

|

Remarks

If the AllowHtmlDrawHeaders property is set to true , you can use HTML tags to format the GridColumn.Caption and GridBand.Caption. For detailed information see HTML Text Formatting.

Note

  • Hints don’t support HTML formatting. They display plain text without tags.

Example

The following example shows how to display an image to the right of the Customer column’s caption using HTML tags. The HTML formatting feature is enabled via the GridOptionsView.AllowHtmlDrawHeaders property.

csharp
string imageName = "customer";
imageCollection1.AddImage(Image.FromFile("c:\\customer-16x16.png"), imageName);

gridView1.OptionsView.AllowHtmlDrawHeaders = true;
gridView1.HtmlImages = imageCollection1;
columnCustomer.Caption = columnCustomer.GetCaption() + "<image=" + imageName + ">";
vb
Dim imageName As String = "customer"
imageCollection1.AddImage(Image.FromFile("c:\customer-16x16.png"), imageName)

gridView1.OptionsView.AllowHtmlDrawHeaders = True
gridView1.HtmlImages = imageCollection1
columnCustomer.Caption = columnCustomer.GetCaption() & "<image=" & imageName & ">"

Example

The following example shows how to format the GridBand.Caption using HTML tags. HTML formatting is enabled via the GridOptionsView.AllowHtmlDrawHeaders property. The image below shows the result:

csharp
gridBand1.Caption = "Production
<b>costs</b>";

bandedGridView1.OptionsView.AllowHtmlDrawHeaders = true;
bandedGridView1.Appearance.HeaderPanel.Options.UseTextOptions = true;
bandedGridView1.Appearance.HeaderPanel.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
vb
gridBand1.Caption = "Production
<b>costs</b>"

bandedGridView1.OptionsView.AllowHtmlDrawHeaders = True
bandedGridView1.Appearance.HeaderPanel.Options.UseTextOptions = True
bandedGridView1.Appearance.HeaderPanel.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap

See Also

GridColumn.Caption

GridBand.Caption

HtmlImages

HTML-inspired Text Formatting

GridOptionsView Class

GridOptionsView Members

DevExpress.XtraGrid.Views.Grid Namespace