Skip to main content
.NET 6.0+

AppearanceObject Class

An appearance generated by combining all the found conditional appearance rules appropriate for the target UI element.

Namespace: DevExpress.ExpressApp.ConditionalAppearance

Assembly: DevExpress.ExpressApp.ConditionalAppearance.v24.1.dll

Declaration

public class AppearanceObject

Remarks

When declaring conditional appearance rules, it may be required to customize the appearance applied to specific UI elements or under specific circumstances. For this purpose, handle the AppearanceController‘s AppearanceController.CustomApplyAppearance and AppearanceController.AppearanceApplied events. The ApplyAppearanceEventArgs object, passed as a parameter in the event handlers, provides access to the appearance that is about to be applied if you get it in the CustomApplyAppearance event handler, or to the appearance that has been just applied if you get it in the AppearanceApplied event handler. The appearance is represented by the AppearanceObject. It allows you to determine which customizations form the appearance applied. For this purpose, use the AppearanceObject.Enabled, AppearanceObject.Visibility, AppearanceObject.BackColor, AppearanceObject.FontColor and AppearanceObject.FontStyle properties. If you need to modify an appearance to be applied, you can get the AppearanceObject and specify its properties in the required way. This should be performed in the CustomApplyAppearance event handler. Note - if you leave the Handled parameter set to false, the modified appearance will be applied by the AppearanceController. If you set the Handled parameter to true, you should apply the modified appearance yourself. In this instance, the following code may help you perform your task:

using DevExpress.ExpressApp.ConditionalAppearance;
using DevExpress.ExpressApp.Editors;
//...
public partial class ConditionalAppearanceController : ViewController {
    public ConditionalAppearanceController() {
        InitializeComponent();
    }
    private AppearanceController appearanceController;
    protected override void OnActivated() {
        base.OnActivated();
        appearanceController = Frame.GetController<AppearanceController>();
        if (appearanceController != null) {
            appearanceController.CustomApplyAppearance += 
                new EventHandler<ApplyAppearanceEventArgs>(
                    appearanceController_CustomApplyAppearance);
        }
    }
    void appearanceController_CustomApplyAppearance (
        object sender, ApplyAppearanceEventArgs e) {
            //Customize the AppearanceObject
            //Apply the modified appearance
            foreach(AppearanceItemBase appearanceItem in e.AppearanceObject.Items) {
                appearanceItem.Apply(e.Item);
            }
    }
    protected override void OnDeactivated() {
        if (appearanceController != null) {
            appearanceController.CustomApplyAppearance -=
                 new EventHandler<ApplyAppearanceEventArgs>(
                     appearanceController_CustomApplyAppearance);
        }
        base.OnDeactivated();
    }
}

Inheritance

Object
AppearanceObject
See Also