enter image description hereenter image description here
I have a custom control with Style as <Style TargetType=”{x:Type local:IconCustom}”> <Setter Property=”Template”> <Setter.Value> <ControlTemplate TargetType=”{x:Type local:IconCustom}”> <Border x:Name=”border” Background=”{TemplateBinding Background}” BorderBrush=”{TemplateBinding BorderBrush}” BorderThickness=”{TemplateBinding BorderThickness}”> <Border.Style> <Style TargetType=”Border”> <Style.Triggers> <Trigger Property=”IsMouseOver” Value=”True”> <Setter Property=”Background” Value=”Red”/> </Trigger> </Style.Triggers> </Style> </Border.Style> <TextBlock Text=”Abcde”/> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> the custom control is place in CustomTest <uc:IconCustom Width=”400″ Height=”400″ Style=”{StaticResource IconButtonStyle}”/> with a Style <Style TargetType=”{x:Type uc:IconCustom}” x:Key=”IconButtonStyle”> <Style.Triggers> <Trigger Property=”IsMouseOver” Value=”True”> <Setter Property=”Background” Value=”Yellow”/> </Trigger> </Style.Triggers> </Style> here Yellow is not overriding on Red for MouseOver, why this happens, How to fix?
Tried setting Default style for MouseOver, and Style from CustomTest, it also not worked, I want if no style is given in CustomTest, then Default style (Red) will take, otherwise if Style applied in CustomTest, then Yellow will take,