Control.Template Property
Gets or sets a control template.
Namespace: System.Windows.Controls
Assembly: System.Windows (in System.Windows.dll)
<control Template="{StaticResource templateResourceKey}"/>
XAML Values
Note: |
|---|
Property element syntax to define an inline template is technically possible, but not recommended for most template scenarios. See Inline Styles and Templates. |
Property Value
Type: System.Windows.Controls.ControlTemplateThe template that defines the appearance of the Control.
Dependency property identifier field: TemplateProperty
The ControlTemplate specifies the appearance of a Control; if a Control does not have a ControlTemplate, the Control will not appear in your application. The control author defines the default control template, and the application author can override the ControlTemplate to redefine the visual tree of the control.
Control templates are typically set in XAML as part of a control-specific implicit style. In this case, a Property value in the style is set as the string Template, and the Setter.Value value is set as a property element, which contains a ControlTemplate object element. For example:
<Style TargetType="ScrollViewer">
...
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollViewer">
//visual root of template for a ScrollViewer
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Note: