I would like to create a reusable WPFToolkit IntegerUpDown so I do not need to copy and paste the same style with triggers on different bindings over and over again.
I've attempted to use DataTemplates but I'm unsure where I can provide the source for the IntegerUpDown component when I provide the template.
<xctk:IntegerUpDown Value="{Binding Person.Age.Value}">
<xctk:IntegerUpDown.Style>
<Style TargetType="{x:Type xctk:IntegerUpDown}">
<Style.Triggers>
<DataTrigger Binding="{Binding Person.Age.DataDirty}" Value="True">
<Setter Property="BorderBrush" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding Person.Age.DataDirty}" Value="False">
<Setter Property="BorderBrush" Value="Black"/>
</DataTrigger>
</Style.Triggers>
</Style>
</xctk:IntegerUpDown.Style>
</xctk:IntegerUpDown>
Is there a way that this component can be generic enough so it can be applied similarly to:
<xctk:IntegerUpDown
Source="{Binding Source={StaticResource Person.Age}}"
Template="{StaticResource myPersonInfo}"/>