Back to Devexpress

AppearanceAttribute.TargetItems Property

expressappframework-devexpress-dot-expressapp-dot-conditionalappearance-dot-appearanceattribute-fa1225f9.md

latest5.0 KB
Original Source

AppearanceAttribute.TargetItems Property

Specifies the identifiers of UI elements affected by the conditional appearance rule.

Namespace : DevExpress.ExpressApp.ConditionalAppearance

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

NuGet Package : DevExpress.Persistent.Base

Declaration

csharp
public string TargetItems { get; set; }
vb
Public Property TargetItems As String

Property Value

TypeDescription
String

A string consisting of is semicolon separated identifiers of the UI elements affected by the conditional appearance rule.

|

Remarks

In Detail Views, identifiers, passed to the TargetItems property are Id property values of the Application Model nodes that correspond to the UI elements (e.g., IModelMember, IModelLayoutItem, IModelAction, etc.). In List Views, these identifiers are property names.

You can specify several UI elements of the type specified via the IAppearanceRuleProperties.AppearanceItemType property to be affected by the conditional appearance rule. See the possible variants for specifying the TargetItems value in the following table:

ExampleDescription
“TargetElementId”An identifier of the individual target element. The element with the “TargetElementId” identifier is affected.
“TargetElementId1;TargetElementId2”A semicolon-separated list of target element identifiers. The listed elements are affected.
“*“An asterisk (*) wildcard. All elements are affected.
“*;TargetElementId1;TargetElementId2”An asterisk (*) wildcard, followed by a semicolon-separated list of target element identifiers. All elements, except for those listed, are affected.

Note

You cannot specify “all Actions” via the “*“ wildcard. To specify several Actions, list their identifiers explicitly. When the AppearanceItemType is Action , the asterisk sign is interpreted as a reference to an Action that has the “*“ identifier.

Example

The following code snippet changes the ProductParameters layout group caption in Product Detail Views to blue when the product’s category is “Seafood”:

csharp
using DevExpress.ExpressApp.ConditionalAppearance;
//...
[Appearance("LayoutGroupColoredInDetailView", AppearanceItemType = "LayoutItem",
 TargetItems = "ProductParametersLayoutGroup", Criteria = "Category = 'Seafood'",
 Context = "Product_DetailView", FontColor = "Blue")]
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; }
}

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

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.
csharp
using DevExpress.ExpressApp.ConditionalAppearance;
//...
[Appearance("LayoutGroupColoredInDetailView", AppearanceItemType = "LayoutItem",
 TargetItems = "ProductParametersLayoutGroup", Criteria = "Category = 'Seafood'",
 Context = "Product_DetailView", FontColor = "Blue")]
public class Product : BaseObject {
    public Product(Session session) : base(session) { }
    public string Name {
        //...
    }
    public decimal Price {
        //...
    }
    public ProductStatus Status {
        //...
    }
    public Category Category {
        //...
    }
}
[DefaultProperty(nameof(Name))]
public class Category : BaseObject {
    public Category(Session session) : base(session) {}
    public string Name {
        //...
    }
}

Implements

TargetItems

See Also

Conditional Appearance (Manage UI State)

AppearanceAttribute Class

AppearanceAttribute Members

DevExpress.ExpressApp.ConditionalAppearance Namespace