I do have a control template for WPF button. Within the template I can use the Fillcolor and Backcolor of the button. But is it possible to define a third color that can be used in the template and later on in a real button?
Here an example of a circular button. I would like to add a color for the ToggleButton.IsChecked state.
<ControlTemplate x:Key="MyButtonTemplate" TargetType="{x:Type ToggleButton}">
<Grid>
<Ellipse x:Name="outerCircle" Width="Auto" Height="Auto" StrokeThickness="4" Fill="White" Stroke="Gray"/>
<Label x:Name="content" Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gray"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="outerCircle" Property="Fill" Value="{Binding Path=Foreground, RelativeSource='{RelativeSource TemplatedParent}'}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="outerCircle" Property="Fill" Value="LightGray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="outerCircle" Property="Fill" Value="{Binding Path=Foreground, RelativeSource='{RelativeSource TemplatedParent}'}"/>
<Setter TargetName="content" Property="Foreground" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
I am not sure wether or not you want to bind this to a property or just use a brush resource, Here is an example using a Resource:
Base on the clarification that you wanted to be able to set the property on the ToggleButton you will need to use a Dependecy Property here is a quick example:
Custom Control
MainWindow.xaml