Skip to main content
edited tags
Link
Dave Clemmer
  • 3.8k
  • 12
  • 53
  • 72
Source Link
James Cadd
  • 12.2k
  • 30
  • 87
  • 135

WPF - Use a ControlTemplate resource within a Style

When creating a Style, is it possible to set the ControlTemplate property to a previously defined resource? For example, if I had the following in a ResourceDictionary:

<ControlTemplate x:Key="MyControlTemplate" TargetType="{x:Type Button}"> ... </ControlTemplate> 

And then later wanted to use it in a Style like this:

<Style x:Key="MyStyle" TargetType="{x:Type Button}"> <Setter Property="Template" Value="???"/> </Style> 

Is that possible?