Share via


StyleSelector Class

Definition

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

/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class StyleSelector
[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
Public Class StyleSelector
See Remarks
Inheritance
Object IInspectable 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

See also