Class VisualRoleEventArgs
Provides data for cancellable workflow events that resolve an Attribute for a specific VisualRole in the Cancellable Work Pattern (CWP).
public class VisualRoleEventArgs : ResultEventArgs<Attribute?>
- Inheritance
-
VisualRoleEventArgs
- Inherited Members
Examples
View view = new();
view.GettingAttributeForRole += (sender, args) =>
{
if (args.Role == VisualRole.Focus)
{
args.Result = new Attribute(Color.BrightCyan, Color.Black);
args.Handled = true;
}
};
Attribute attribute = view.GetAttributeForRole(VisualRole.Focus);
Remarks
Used in events like GettingAttributeForRole to allow customization or cancellation of attribute resolution for a VisualRole, such as determining the appearance of a View based on its state (e.g., focused, disabled).
Inherits from ResultEventArgs<T> with T = Attribute
, providing a
cancellable result workflow where event handlers can supply a custom Attribute or mark
the operation as handled.
Constructors
- VisualRoleEventArgs(in VisualRole, Attribute?)
Initializes a new instance of the VisualRoleEventArgs class with the specified VisualRole and initial Attribute result.
Properties
- Role
Gets the VisualRole for which an Attribute is being resolved.