AppearanceController.RefreshItemAppearance(View, String, String, Object, Object) Method
Collects and applies the conditional appearance rules appropriate for the specified UI element.
Namespace: DevExpress.ExpressApp.ConditionalAppearance
Assembly: DevExpress.ExpressApp.ConditionalAppearance.v24.1.dll
NuGet Package: DevExpress.ExpressApp.ConditionalAppearance
Declaration
Parameters
Name | Type | Description |
---|---|---|
view | View | A View object that is the View in which the target UI element (View Items and Layout Items and Groups) is contained. If the target UI element is an Action, this View is the one for which it is activated. |
itemType | String | A string that is the type of the target UI element whose conditional appearance is about to be refreshed. |
itemName | String | A string that is the identifier of the UI element whose conditional appearance is about to be refreshed. |
item | Object | A UI element whose conditional appearance is about to be refreshed by applying the appropriate rules. |
contextObject | Object | An object that contains the properties whose controls or layout items are about to be refreshed by applying the appropriate rules. When the target item is an Action, the selected object(s) is passed as this parameter. |
Remarks
To collect rules appropriate for the target item, this method first scans the Application Model‘s BOModel | <Class> | AppearanceRules node corresponding to the business object represented by the View passed as the view parameter. To access the list of the rules found, handle the AppearanceController.CollectAppearanceRules event. In the event handler, you can declare conditional appearance rules for a particular item dynamically and add them to the rules list returned by the CollectAppearanceRulesEventArgs.AppearanceRules event handler parameter.
After rules for the target item are collected, they are reviewed, to leave only those rules that satisfy the following conditions:
- The item passed as the itemName parameter is contained in the IAppearanceRuleProperties.TargetItems list;
- The value passed as the itemType parameter is similar to the IAppearanceRuleProperties.AppearanceItemType property value;
- The View passed as the view parameter is contained in the IAppearanceRuleProperties.Context list;
- The object passed as the contextObject satisfies the criteria specified by the IAppearanceRuleProperties.Criteria or IAppearanceRuleProperties.Method rule property.
To apply the rules to the target item, an AppearanceObject is generated. This object contains a list of the appearances (Enabled, Visible, BackColor, FontColor and FontStyle) to be applied to the target item. These appearances are received by combining all the rules found according to their priority (see IAppearance.Priority). To access the AppearanceObject, handle the AppearanceController.CustomApplyAppearance event and use the ApplyAppearanceEventArgs.AppearanceObject event handler parameter.
The apply the resulting appearance to the target item, this item should implement any set of the following interfaces:
To apply a custom conditional appearance to a particular item, handle the AppearanceController.CustomApplyAppearance event and set the event handler’s Handled parameter to true to avoid applying the prepared appearance.
To customize the applied appearance, handle the AppearanceController.AppearanceApplied event.
The RefreshItemAppearance method is called by the View Controllers registered in the Appearance Controller when the AppearanceController.Refresh method is invoked (see AppearanceController.RegisterController). In addition, this method is called separately by different View Controllers to apply conditional appearance rules to UI elements in particular situations. You can also call this method, when required, from any View Controller.