StyledElementTrigger.cs 837 B

1234567891011121314151617181920212223
  1. using Avalonia.Metadata;
  2. namespace Avalonia.Xaml.Interactivity;
  3. /// <summary>
  4. /// A base class for behaviors, implementing the basic plumbing of <seealso cref="ITrigger"/>.
  5. /// </summary>
  6. public abstract class StyledElementTrigger : StyledElementBehavior, ITrigger
  7. {
  8. /// <summary>
  9. /// Identifies the <seealso cref="Actions"/> avalonia property.
  10. /// </summary>
  11. public static readonly DirectProperty<StyledElementTrigger, ActionCollection> ActionsProperty =
  12. AvaloniaProperty.RegisterDirect<StyledElementTrigger, ActionCollection>(nameof(Actions), t => t.Actions);
  13. private ActionCollection? _actions;
  14. /// <summary>
  15. /// Gets the collection of actions associated with the behavior. This is a avalonia property.
  16. /// </summary>
  17. [Content]
  18. public ActionCollection Actions => _actions ??= [];
  19. }