In a WPF application I have a style used for buttons:
<Style TargetType="Button" x:Key="ButtonEllipse">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<StackPanel Orientation="Vertical">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 10"/>
<Image x:Name="ButtonImage" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Source="/MyProject;component/Images/ButtonEllipse.png"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
For most buttons that is OK but for one specific instance I want to use the same template but change the image to ButtonEllipseNew.png (which is the value of a view model property). The button is defined like this:
<Button Content="Test" Style="{StaticResource ButtonEllipse}">
</Button>
How can I change the value of the image source in the template only for this specific button? I want to bind the source to a property in the view model.