StyleSelector Class

Definition

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

C#
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class StyleSelector
XAML
See Remarks
Inheritance
Object StyleSelector
Attributes

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()

Initializes a new instance of the StyleSelector class.

Methods

SelectStyle(Object, DependencyObject)

Returns a specific Style based on custom logic.

SelectStyleCore(Object, DependencyObject)

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

Applies to

Product Versions
Windows App SDK 0.8, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6

See also