XRControl.StylePriority Property
Allows you to specify properties whose values for an individual control have priority over the same properties specified for the style assigned to the control.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
[SRCategory(ReportStringId.CatAppearance)]
public virtual StylePriority StylePriority { get; }
Property Value
Type | Description |
---|---|
StylePriority | A StylePriority object, which contains style priority settings. |
Remarks
In a default style scenario, the style properties take precedence over the property values set for an individual control. This means that all properties of the StylePriority object returned by the StylePriority
property are set to true
.
If you want a property value of the control to apply rather than the style value, set the appropriate Use...
property to false
. In other words, to make the control use its own individual background color, set the StylePriority.UseBackColor property to false
.
The following code snippet creates two labels with different background colors. The myLabel1
control has a light blue background determined by the MyStyle1
style’s XRControlStyle.BackColor property. The mylabel2
control has an orange background determined by the control’s BackColor property.
using System;
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...
XtraReport myReport = new XtraReport();
myReport.Bands.Add(new DetailBand());
XRControlStyle myStyle = new XRControlStyle {
Name = "MyStyle1",
BackColor = Color.LightBlue
};
myReport.StyleSheet.Add(myStyle);
XRLabel myLabel1 = new XRLabel {
Text = "One",
StyleName = "MyStyle1",
BackColor = Color.Black,
LocationF = new PointF(0F, 0F)
};
XRLabel myLabel2 = new XRLabel {
Text = "Two",
BackColor = Color.Orange,
StyleName = "MyStyle1",
LocationF = new PointF(200F, 0F),
};
myLabel2.StylePriority.UseBackColor = false;
myReport.Bands[BandKind.Detail].Controls.AddRange(
new XRControl[] { myLabel1, myLabel2 });
For more information about styles and style inheritance in DevExpress Reporting, review the following help topic: Report Visual Styles.