StyleSelector StyleSelector StyleSelector StyleSelector Class

Definition

Enables custom item style selection logic as a function of the content data and its specific item container.

public : class StyleSelector : IStyleSelector, IStyleSelectorOverridespublic class StyleSelector : IStyleSelector, IStyleSelectorOverridesPublic Class StyleSelector Implements IStyleSelector, IStyleSelectorOverrides// This API is not available in Javascript.
See Remarks
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The base StyleSelector class is not used as an object element in XAML. However, it is a common scenario to derive a custom StyleSelector, 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 ItemContainerStyleSelector in XAML templates and particular visual states.

Constructors

StyleSelector() StyleSelector() StyleSelector() StyleSelector()

Initializes a new instance of the StyleSelector class.

public : StyleSelector()public StyleSelector()Public Sub New()// This API is not available in Javascript.

Methods

SelectStyle(Object, DependencyObject) SelectStyle(Object, DependencyObject) SelectStyle(Object, DependencyObject) SelectStyle(Object, DependencyObject)

Returns a specific Style based on custom logic.

public : Style SelectStyle(PlatForm::Object item, DependencyObject container)public Style SelectStyle(Object item, DependencyObject container)Public Function SelectStyle(item As Object, container As DependencyObject) As Style// This API is not available in Javascript.
Parameters
item
PlatForm::Object Object Object Object

The content.

container
DependencyObject DependencyObject DependencyObject DependencyObject

The element to which the style is applied.

Returns

An application-specific style to apply; may also return null.

Remarks

To provide a specific style in a derived class, override the SelectStyleCore method.

SelectStyleCore(Object, DependencyObject) SelectStyleCore(Object, DependencyObject) SelectStyleCore(Object, DependencyObject) SelectStyleCore(Object, DependencyObject)

When implemented by a derived class, returns a specific Style based on custom logic.

protected : virtual Style SelectStyleCore(PlatForm::Object item, DependencyObject container)protected virtual Style SelectStyleCore(Object item, DependencyObject container)Protected Overridable Function SelectStyleCore(item As Object, container As DependencyObject) As Style// This API is not available in Javascript.
Parameters
item
PlatForm::Object Object Object Object

The content.

container
DependencyObject DependencyObject DependencyObject DependencyObject

The element to which the style is applied.

Returns

An application-specific style to apply; may also return null.