expressappframework-devexpress-dot-expressapp-dot-conditionalappearance-dot-appearanceattribute-ef7b2c3b.md
Specifies the font color of AppearanceAttribute.TargetItems affected by the conditional appearance rule generated from this attribute instance.
Namespace : DevExpress.ExpressApp.ConditionalAppearance
Assembly : DevExpress.Persistent.Base.v25.2.dll
NuGet Package : DevExpress.Persistent.Base
public string FontColor { get; set; }
Public Property FontColor As String
| Type | Description |
|---|---|
| String |
A string specifying the font color of target items affected by the conditional appearance rule. A value should be recognizable by the System.Drawing.ColorConverter class.
|
The following UI elements can change their font color:
GridListEditor (the font color of the displayed text)TreeListEditor (the font color of the displayed text)Example 1
The following code snippet changes the Category property in List Views to blue 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.
using DevExpress.ExpressApp.ConditionalAppearance;
//...
[Appearance("CategoryColoredInListView", AppearanceItemType = "ViewItem", TargetItems = "Category",
Criteria = "Category = 'Seafood'", Context = "ListView", FontColor = "Blue", Priority = 1)]
public class Product : BaseObject {
public Product(Session session) : base(session) { }
public Category Category {
//...
}
}
[DefaultProperty(nameof(Name))]
public class Category : BaseObject {
public Category(Session session) : base(session) {}
public string Name {
//...
}
}
Example 2
The following code snippet changes the ProductParameters layout group caption in Product Detail Views to blue when the product’s category is “Seafood”:
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.
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 {
//...
}
}
Tip
You can find examples of this functionality in the MainDemo demo included with XAF. The demo illustrates various XAF features (including Appearance attribute) and is located in the %PUBLIC%\Documents\DevExpress Demos 25.2\Components\XAF\MainDemo.NET.EFCore folder.
See Also