Skip to main content
.NET 8.0+

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

AppearanceAttribute.BackColor Property

Specifies the background color of UI elements affected by the conditional appearance rule generated from this attribute instance.

Namespace: DevExpress.ExpressApp.ConditionalAppearance

Assembly: DevExpress.Persistent.Base.v24.2.dll

#Declaration

public string BackColor { get; set; }

#Property Value

Type Description
String

A string specifying the background color of UI elements affected by the conditional appearance rule. A value should be recognizable by the System.Drawing.ColorConverter class.

#Remarks

The following UI elements can change their background color:

Note

It is not recommended to apply the same background color for all business class properties. This setting changes the background color of selected rows in the GridControl, so the selection will be invisible when rows with the modified background color are selected. Additionally, note that the font color depends on the current skin (see IModelApplicationOptionsSkin.Skin). So, ensure that the specified background color does not make the text unreadable in certain skins.

According to the rule demonstrated in the example below, the Product objects whose Price is more than 50 will be displayed in Red background using Maroon font color in List Views.

using DevExpress.ExpressApp.ConditionalAppearance;
//...
[Appearance("RedPriceObject", AppearanceItemType = "ViewItem", TargetItems = "*",
    Criteria = "Price>50", Context = "ListView", BackColor = "Red",
        FontColor = "Maroon", Priority = 2)]
public class Product : BaseObject {
    public virtual string Name { get; set; }
    public virtual decimal Price { get; set; }
    public virtual ProductStatus Status { get; set; }
    public virtual Category Category { get; set; }
}

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.

You will find many examples demonstrated in the FeatureCenter demo installed with XAF. This demo is located in the %PUBLIC%\Documents\DevExpress Demos 24.2\Components\XAF\FeatureCenter.NETFramework.XPO folder, by default.

See Also