SelectTemplateCore method
Collapse the table of content
Expand the table of content

DataTemplateSelector.SelectTemplateCore methods

When implemented by a derived class, returns a specific DataTemplate for a given item or container.

Overload list

MethodDescription
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

If your ItemsControl.ItemsPanel is an ItemsStackPanel or ItemsWrapGrid, provide an override for the SelectTemplateCore(Object) method. If the ItemsPanel is a different panel, such as VirtualizingStackPanel or WrapGrid, provide an override for the SelectTemplateCore(Object, DependencyObject) method.

Note  In Windows 8.1, ItemsStackPanel is the default ItemsPanel for ListView, and ItemsWrapGrid is the default ItemsPanel for GridView.
 

For example XAML that references a custom DataTemplateSelector as the HeaderTemplateSelector value, and example code that shows the overrides for HeaderTemplateSelector methods, see How to group items in a list or grid.

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

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

DataTemplateSelector
DataTemplate
How to group items in a list or grid
Adding ListView and GridView controls

 

 

Show:
© 2016 Microsoft