ControlTemplate.TargetType Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the type to which the ControlTemplate is applied.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public Type TargetType { get; set; }
<ControlTemplate TargetType="typeName"/>

XAML Values


A string that specifies the type name of the type where the template is applied.

Property Value

Type: System.Type
The type to which the ControlTemplate is applied.

The Windows Phone XAML processing behavior has special handling for property values that are of type Type. This behavior is to construct a Type instance as necessary based on its type name. You specify that name as the typeName attribute value as shown in the XAML syntax section. Note that {x:Type} is not supported in XAML for Windows Phone (you might have {x:Type} usages if you are migrating XAML). If you have {x:Type typeName} attribute values for TargetType, change them to just typeName.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone