FrameworkTemplate class
Collapse the table of content
Expand the table of content

FrameworkTemplate class

Creates an element tree of elements. FrameworkTemplate is a base class for classes that have specific templating behavior, including ControlTemplate and DataTemplate.




public class FrameworkTemplate : DependencyObject


The FrameworkTemplate class has these types of members:


The FrameworkTemplate class has these constructors.

FrameworkTemplate Provides base class initialization behavior for FrameworkTemplate-derived classes.



The FrameworkTemplate class has these methods. It also inherits methods from the Object class.

ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject)
RegisterPropertyChangedCallback Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance. (Inherited from DependencyObject)
SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject)
UnregisterPropertyChangedCallback Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback. (Inherited from DependencyObject)



The FrameworkTemplate class has these properties.

PropertyAccess typeDescription



Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread. (Inherited from DependencyObject)



FrameworkTemplate has a ContentPropertyAttribute that indicates that its XAML content property is named "Template". FrameworkTemplate doesn't define a property of that name, nor do its derived types that have a practical usage (ControlTemplate, DataTemplate). The content of a FrameworkTemplate is a root element that should be created when the template is applied to the object being templated, and isn't a conventional property in the object model. Content of a FrameworkTemplate is handled specially by the XAML parser when content is created from a template.

For more info on how to use templates, see ControlTemplate and Quickstart: Control templates.

FrameworkTemplate derived classes

FrameworkTemplate is the parent class for several immediately derived classes that each define specific templating behavior. Here are some of the notable derived classes:

  • ControlTemplate: this is used as the value of the Control.Template property, which defines the visuals of a control by applying the template. You almost always define a ControlTemplate as a XAML resource, using an implicit key TargetType that is the same as a Style that sets Control.Template with a Setter. You rarely if ever assign a value for Control.Template directly on a control instance.
  • DataTemplate: specifies the visual representation of your data when it's supplying items for an items control, such as a ListView or GridView. A DataTemplate sets the ItemTemplate property for an items control. DataTemplate is also used for ContentControl.ContentTemplate and other control-specific data templating properties, such as various Header, HeaderTemplate, ContentTemplate and ItemTemplate properties on multiple classes.
  • ItemsPanelTemplate: supports an alternative technique for representing data in the visuals of a control, by defining a layout container as well as parts within that container that present the data. ItemsPanelTemplate is used as the value of ItemsControl.ItemsPanel for items controls.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml [C++]





See also

Quickstart: Control templates



© 2017 Microsoft