Skip to main content
.NET Framework 4.5.2+

AppearanceAttribute.Priority Property

Specifies the priority of the conditional appearance rule generated from the current attribute instance. Used when several rules affect the same UI element.

Namespace: DevExpress.ExpressApp.ConditionalAppearance

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

Declaration

public int Priority { get; set; }

Property Value

Type Description
Int32

An integer value specifying the volume of the conditional appearance rule.

Remarks

There can be several conditional appearance rules affecting the UI element specified by AppearanceAttribute.TargetItems. In this instance, the rules are applied according to the volume specified by the Priority property. Rules with a higher volume may override changes made by rules with a lower volume.

If the Priority is not specified, a rule that applies customization always has priority over a rule that cancels customization for the same editor.

Note

Priority is ignored for rules that change an item’s visibility, Enabled state and font style.

  • Enabled: False has higher priority than True
  • Visibility: Hide has higher priority than ShowEmptySpace; ShowEmptySpace has higher priority than Visible.
  • FontStyle: Regular has lowest priority. Other styles are combined by disjunction.

In the following examples, the Category property is displayed in a Maroon font according to the rule from the first example, and the same property is displayed in a Blue font according to the rule from the second example. When both these rules are applied to the Product class, the priority should be set. Here, the rule from the first example has the higher volume (Priority = 2). So, Category is shown in maroon.

Example 1

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.

Example 2

According to the rule demonstrated in the example below, the Category property in List Views will be displayed in Blue font color when its value is “Seafood”.

using DevExpress.ExpressApp.ConditionalAppearance;
//...
[Appearance("CategoryColoredInListView", AppearanceItemType = "ViewItem", TargetItems = "Category",
 Criteria = "Category = 'Seafood'", Context = "ListView", FontColor = "Blue", Priority = 1)]
public class Product : BaseObject {
    public virtual Category Category { get; set; }
}

[DefaultProperty(nameof(Name))]
public class Category : BaseObject {
    public virtual string Name { get; set; }
}

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

ConditionalAppearance_Priority

Implements

See Also