DataTemplateSelector class

Applies to Windows and Windows Phone

Enables custom template selection logic at the application level.

Inheritance

Object
  DataTemplateSelector

Syntax


public ref class DataTemplateSelector 


See Remarks

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The DataTemplateSelector class has these types of members:

Constructors

The DataTemplateSelector class has these constructors.

ConstructorDescription
DataTemplateSelector Initializes a new instance of the DataTemplateSelector class.

 

Methods

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

MethodDescription
SelectTemplate(Object) Returns a specific DataTemplate for a given item.
SelectTemplate(Object, DependencyObject) Returns a specific DataTemplate for a given item or container.
SelectTemplateCore(Object) When implemented by a derived class, returns a specific DataTemplate for a given item or container.
SelectTemplateCore(Object, DependencyObject) When implemented by a derived class, returns a specific DataTemplate for a given item or container.

 

Remarks

The base DataTemplateSelector class is not used as an object element in XAML. However, it is a common scenario to derive a custom DataTemplateSelector, map a xmlns prefix for the custom class and its namespace/assembly, and then refer to an instance of the custom class as defined in a Resources block in XAML. This makes it possible to refer to the custom template selector class by x:Key, and use that reference to set the value of properties such as ItemTemplateSelector in XAML templates and visual states.

Requirements

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]

Namespace

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

Metadata

Windows.winmd

See also

ItemTemplateSelector

 

 

Show:
© 2014 Microsoft. All rights reserved.