AppearanceAttribute(String) Constructor
Creates a new instance of the AppearanceAttribute class.
Namespace: DevExpress.ExpressApp.ConditionalAppearance
Assembly: DevExpress.Persistent.Base.v24.1.dll
NuGet Package: DevExpress.Persistent.Base
Declaration
Parameters
Name | Type | Description |
---|---|---|
id | String | A string that is the unique identifier for the appearance rule created using the current attribute instance. |
Remarks
This constructor sets the following attribute properties:
- AppearanceAttribute.Id is set to the value passed as the id parameter;
- AppearanceAttribute.Context is set to Any (a default value);
- AppearanceAttribute.AppearanceItemType is set to ViewItem (a default value).
The remaining properties can be specified using the constructor’s named parameters.
To learn how to define a rule using the Appearance attribute, refer to the Declare Conditional Appearance Rules in Code topic.
Example
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.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the AppearanceAttribute(String) constructor.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.