The following xaml demonstrates the issue:
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions">
<Grid.Resources>
<SolidColorBrush x:Key="greenBrush" Color="#FF0A9F26" />
<SolidColorBrush x:Key="purpleBrush" Color="#FF8E0795"/>
<SolidColorBrush x:Key="orangeBrush" Color="#FF913B00" />
<ControlTemplate x:Key="temp" TargetType="ContentControl">
<Canvas Width="200" Height="100">
<i:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding Offset}" Value="1">
<ei:ChangePropertyAction TargetName="bd" PropertyName="Background" Value="{StaticResource purpleBrush}"/>
</ei:DataTrigger>
<ei:DataTrigger Binding="{Binding Offset}" Value="2">
<ei:ChangePropertyAction TargetName="bd" PropertyName="Background" Value="{StaticResource orangeBrush}"/>
</ei:DataTrigger>
</i:Interaction.Triggers>
<Border Name="bd" Background="{StaticResource greenBrush}" Padding="20,10">
<TextBlock Text="{Binding Color, FallbackValue=#FF0A9F26}" FontSize="32"/>
</Border>
</Canvas>
</ControlTemplate>
<GradientStop x:Key="ctx1" Offset="1" Color="#FF8E0795"/>
<GradientStop x:Key="ctx2" Offset="2" Color="#FF913B00"/>
</Grid.Resources>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<ContentControl Template="{StaticResource temp}"/>
<ContentControl Template="{StaticResource temp}" DataContext="{StaticResource ctx1}"/>
<ContentControl Template="{StaticResource temp}" DataContext="{StaticResource ctx2}"/>
</StackPanel>
</Grid> |