Dela via


DataTemplateSelector.SelectTemplateCore Method

Definition

Overloads

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.

SelectTemplateCore(Object)

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

/// [Windows.Foundation.Metadata.Overload("SelectTemplateForItemCore")]
DataTemplate SelectTemplateCore(IInspectable const& item);
[Windows.Foundation.Metadata.Overload("SelectTemplateForItemCore")]
protected virtual DataTemplate SelectTemplateCore(object item);
function selectTemplateCore(item)
Protected Overridable Function SelectTemplateCore (item As Object) As DataTemplate

Parameters

item
Object

IInspectable

The item to return a template for.

Returns

The template to use for the given item and/or container.

Attributes

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.

See also

Applies to

SelectTemplateCore(Object, DependencyObject)

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

DataTemplate SelectTemplateCore(IInspectable const& item, DependencyObject const& container);
protected virtual DataTemplate SelectTemplateCore(object item, DependencyObject container);
function selectTemplateCore(item, container)
Protected Overridable Function SelectTemplateCore (item As Object, container As DependencyObject) As DataTemplate

Parameters

item
Object

IInspectable

The item to return a template for.

container
DependencyObject

The parent container for the templated item.

Returns

The template to use for the given item and/or container.

Remarks

Important

This overload of SelectTemplateCore should not be used. It will not be called by certain controls like TreeView and ItemsRepeater where the template creates the container as well as the item. Please use the overload without the container instead.

Most implementations will choose to implement the selection logic based on the value of either item or container, not both. Implementations should still pass the unused parameter as-is to base.

See also

Applies to