When I put button on a toolbar, its style changes automatically to match the toolbar elements.
I derived my own class from a ToggleButton, and now if I instantiate one on the toolbar, it looks like ordinary button again. How can I access the built-in templates of the WPF, such that I don’t have to recreate the whole template from scratch?
Apparently the ToolBar has resources defined for some controls including
ButtonandToggleButton. This styles, you cand find them in ToolBar’s metadata, are applied to each control of it’s target type. So you can get the style and apply it yourself:If you have a lot of button’s and don’t want to set the style for each one you could set the style in codebehind of your custom control.