I have a button:
<Button x:Name="someButton"
Template="{StaticResource aButtonTemplate}"
Command="{Binding MyCommand}"
Style="{StaticResource ButtonStyle1}" >
Now, the aButtonTemplate looks like:
<ControlTemplate x:Key="aButtonTemplate" TargetType="{x:Type Button}">
<Border Name="border" Background="Transparent" BorderBrush="Transparent" BorderThickness="2">
<ContentPresenter x:Name="content" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="Red"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Then I have the ButtonStyle1
<Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Viewbox>
<Grid>
<Ellipse Stroke="#f2f2f0" StrokeThickness="3" Fill="red" Width="77" Height="77"/>
</Grid>
</Viewbox>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Now the problem is, due to the line Template="{StaticResource aButtonTemplate}"
the Style ButtonStyle1 is not getting applied. I am not seeing any Ellipse.
How can I get the Style to work along with the Template?
EDIT: As I am specifying the ControlTemplate again in the Style ButtonStyle1, is there a way to combine both the styles into ButtonStyle2 using BasedOn? How can I do it?