Sometimes, when I edit a copy of the original control template, I do not need to change the original styles and colors, and I would like to refer directly to the original ones.
For example, I wanted to modify the ComboBox template to add some filter buttons in the drop-down list, its switch button refers to a style that is also copied to the file. I would like to refer to the original style, so my XAML not too cluttered.
Edit: So here is the part of the XAML code that is created when you decide to edit the copy. The ControlTemplate is what I want to change, but I don't need the ComboBoxToggleButton style, so for toggleButton I would like to set its style to the one from which the ComboBoxToggleButton Style was copied. Is there any namespace in which they are all stored or inaccessible?
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}"> ... </Style> <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}"> <Grid x:Name="templateRoot" SnapsToDevicePixels="true"> ... <ToggleButton x:Name="toggleButton" ... Style="{StaticResource ResourceKey=ComboBoxToggleButton}"/> </Grid> </ControlTemplate>
And about what I would like it to be like
<Window xmlns:baseStyles="{namespace/url to the default wpf styles}"> <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}"> <Grid x:Name="templateRoot" SnapsToDevicePixels="true"> ... <ToggleButton x:Name="toggleButton" ... Style="{StaticResource ResourceKey=baseStyles:ComboBoxToggleButton}"/> </Grid> <ControlTemplate.Triggers> ... </ControlTemplate.Triggers> </ControlTemplate>
source share