I've this RepeatButton:
class ScrollButton : RepeatButton
{
string icon;
public string Icon { get => icon; set { icon = value; setTemplate(); } }
void setTemplate() {
var border = new FrameworkElementFactory(typeof(Border));
var path = new FrameworkElementFactory(typeof(Path)) { Name = "thePath" };
path.SetValue(Path.StretchProperty, Stretch.Uniform);
path.SetValue(Path.FillProperty, Brushes.Gray);
path.SetValue(Path.DataProperty, Geometry.Parse(icon));
border.SetValue(Border.BackgroundProperty, Brushes.Transparent);
border.AppendChild(path);
Template = new ControlTemplate(typeof(RepeatButton)) {
VisualTree = border,
Triggers = {
new Trigger() {
Property = IsMouseOverProperty,
Value = true,
Setters = {
new Setter() {
Property = Path.FillProperty,
Value = Brushes.Blue,
TargetName = "thePath"
}
},
//EnterActions = { new Enter() },
//ExitActions = { new Exit() },
}
}
};
}
}
and if I add it in my view this way:
var button = new ScrollButton() {
Width = 50,
Height = 50,
Icon = Icons.ScrollUp
};
the Trigger works:

I want to give it a ColorAnimation by subclassing TriggerAction class. I've tried this way:
public class Enter : TriggerAction { }
public class Exit : TriggerAction { }
but it gives me this error: 'TriggerAction' does not contain a constructor that takes 0 arguments. How do you subclass and add animations to it?
