Back to Devexpress

AppearanceAttribute.Enabled Property

expressappframework-devexpress-dot-expressapp-dot-conditionalappearance-dot-appearanceattribute-8719c28d.md

latest3.5 KB
Original Source

AppearanceAttribute.Enabled Property

Specifies whether to enable UI elements 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

Declaration

csharp
public bool Enabled { get; set; }
vb
Public Property Enabled As Boolean

Property Value

TypeDescription
Boolean

true, if UI elements affected by the conditional appearance rule must be enabled; otherwise, false.

|

Remarks

The following UI elements can be disabled/enabled:

  • Data cells in a GridListEditor and DxGridListEditor when switching to the inline editing mode
  • Property Editors that are inherited from the PropertyEditor class.
  • Actions

You can find many examples in the Declare Conditional Appearance Rules in Code topic.

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.

The following code snippet disables the NickName property editor in the Employee Detail View.

csharp
using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
// ...
public class Employee : BaseObject {
    // ...
    [Appearance("NickNameDisabled", Context = "Employee_DetailView", AppearanceItemType = "ViewItem", Enabled = false)]
    public virtual string NickName { get; set; }
}

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.
csharp
using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
// ...
public class Employee : BaseObject {
// ...
    [Appearance("NickNameDisabled", Context = "Employee_DetailView", AppearanceItemType = "ViewItem", Enabled = false)]
    public string NickName {
        get {
            return nickName;
        }
        set {
            SetPropertyValue(nameof(NickName), ref nickName, value);
        }
    }
}

See Also

Conditional Appearance (Manage UI State)

AppearanceAttribute Class

AppearanceAttribute Members

DevExpress.ExpressApp.ConditionalAppearance Namespace