WPF: Is there a way to override part of a ControlTemplate without redefining the whole style?

You can base a Style on another Style and override specfic setters:

<Style x:Key="myStyle" TargetType="xctk:ColorPicker" BasedOn="{StaticResource {x:Type xctk:ColorPicker}}">
    <!-- This will override the Background setter of the base style -->
    <Setter Property="Background" Value="Red" />
</Style>

But you cannot “override” only a part of a ControlTemplate. Unfortunately you must then (re)define the entire template as a whole.

Leave a Comment