Search code examples
wpfinheritancestoryboardeventtrigger

Is there any way to inherit from TriggerAction class?


I am not interested in animations and I am trying to make simple setter action to be set without key frames.

I wanted to inherit TriggerAction; make properties that set the new value on target, any additional optional properties so I can use:

<EventTrigger SourceName="btn" RoutedEvent="Click">
    <BooleanActionTrigger TargetName="cb" Property="IsChecked" Value="False"/>
</EventTrigger>

Solution

  • You do not need to have Expression Blend installed. System.Windows.Interactivity for WPF is now available on NuGet. Simply add that NuGet package to your project and write your custom TriggerAction:

    using System.Windows;
    using System.Windows.Interactivity;
    
    public class MyCustomAction : TriggerAction<DependencyObject>
    {
        ...
    }