How can I create a Style
with WPF that applies a color layer to ANY image on mouse over as described below. Image has a transparent background.
Example 1 (normal and mouseover):
Example 2 (normal and mouseover):
For example, let's say I have a RadioButton with an Image
as its Content
. I planned defining a ControlTemplate
to do this but I'm stuck with how to apply a color "layer" to the image.
<RadioButton Template="{StaticResource ColorTemplate}">
<Image Source="/MyProject;component/someimage.png"/>
</RadioButton>
<ControlTemplate x:Key="ColorTemplate">
<Border Background="Transparent">
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
<ControlTemplate.Triggers>
<--CAN THIS BE ACHIEVED THROUGH TRIGGERS?-->
</ControlTemplate.Triggers>
</ControlTemplate>
Is it possible to make this a generic style in XAML that could be applied to any image so that there would be no need to include two (or more) images of the same only to achieve these color effects.