Skip to main content
A newer version of this page is available. .

AppearanceAttribute.AppearanceItemType Property

Specifies the type of UI elements affected by the conditional appearance rule created using this attribute.

Namespace: DevExpress.ExpressApp.ConditionalAppearance

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

Declaration

public string AppearanceItemType { get; set; }

Property Value

Type Description
String

The string representation of an AppearanceItemType enumeration value specifying the type of UI elements affected by the conditional appearance rule.

Remarks

To specify the UI element to be affected, apply the Appearance attribute to the required business class or business class property and use the AppearanceItemType and AppearanceAttribute.TargetItems attribute parameters. For details, refer to the Declare Conditional Appearance Rules in Code topic.

These are the following possible values for the AppearanceItemType attribute parameter:

By default, this property is set to ViewItem.

Examples

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 Product(Session session) : base(session) { }
    public string Name {
        //...
    }
    public decimal Price {
        //...
    }
    public ProductStatus Status {
        //...
    }
    public Category Category {
        //...
    }
}

Example 2.

According to the rule demonstrated in the example below, the Category layout item’s caption in Product Detail Views will be displayed in Blue font color when the Category property value is “Seafood”.

using DevExpress.ExpressApp.ConditionalAppearance;
//...
public class Product : BaseObject {
    public Product(Session session) : base(session) { }
    [Appearance("CategoryColoredInDetailView", AppearanceItemType = "LayoutItem",
         TargetItems = "Category", Criteria = "Category = 'Seafood'", Context = "DetailView",
             FontColor = "Blue")]
    public Category Category {
        //...
    }
}
[DefaultProperty("Name")]
public class Category : BaseObject {
    public Category(Session session) : base(session) {}
    public string Name {
        //...
    }
}

Example 3.

According to the rule demonstrated in the example below, a Product’s Deactivate Action will be hidden when the Status property is set to “Inactive” in all Product Views. Note that the Action ID specified in this rule contains the class name (“Product.Deactivate”), because the Deactivate Action is declared using the ActionAttribute. If an Action is declared in a Controller, specify its ID without the class name, e.g., “Delete” or “Unlink”.

using DevExpress.ExpressApp.ConditionalAppearance;
//...
[Appearance("ActionVisibility", AppearanceItemType = "Action",
    TargetItems = "Product.Deactivate",
        Criteria = "Status = 'Inactive'", Context = "Any", Visibility = ViewItemVisibility.Hide)]
public class Product : BaseObject {
    public Product(Session session) : base(session) { }
    public ProductStatus Status {
        //...
    }   
    [Action(PredefinedCategory.RecordEdit, Caption = "Deactivate Product...", AutoCommit = true,
     TargetObjectsCriteria = "Status = 'Active'",
      SelectionDependencyType = MethodActionSelectionDependencyType.RequireSingleObject)]
    public void Deactivate() {
        Status = ProductStatus.Inactive;
    }
}

There are more examples demonstrated in the Declare Conditional Appearance Rules in Code topic. See these examples in the Feature Center demo installed with the eXpressApp Framework, or refer to the Feature Center demo online.

Implements

See Also