How to Extract Default Control Template In Visual Studio?
Solution 1:
2015 update with clear instructions
In Visual Studio 2013, you can get the default ControlTemplate
of a control in a few simple steps.
-
In the WPF designer, select the relevant control, or place the mouse cursor on the relevant control in the XAML.
-
Press F4 to open the Properties Window.
-
Open the Miscellaneous category to find the Template property, or type Template in the search field at the top of the Window.
-
Click on the little square to the right of the Template field and select the Convert to New Resource... option:
- In the popup dialog, name the new
ControlTemplate
to be added and decide where you want it to be defined:
- Click on the OK button.
EDIT >>>
In Visual Studio 2019 and later, this option seems to be disabled for some reason. A workaround can be found by right-clicking the control in the design view and selecting "Edit Template", then selecting "Edit a Copy...".
Solution 2:
From Visual studio - right click the control, choose properties,
In the properties window look for the Template Property and right click it, choose Extract Value To Resource
That will create a copy of the template in the XAML for you to work on.
Solution 3:
Just to update this question, in VS 11 the XAML designer allows you to do this just like Expression Blend.