StyleSelector Class

Definition

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

/// [Windows.Foundation.Metadata.Composable(Microsoft.UI.Xaml.Controls.IStyleSelectorFactory, Windows.Foundation.Metadata.CompositionType.Public, 65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [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)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class StyleSelector
[Windows.Foundation.Metadata.Composable(typeof(Microsoft.UI.Xaml.Controls.IStyleSelectorFactory), Windows.Foundation.Metadata.CompositionType.Public, 65536, "Microsoft.UI.Xaml.WinUIContract")]
[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)]
[Windows.Foundation.Metadata.WebHostHidden]
public class StyleSelector
Public Class StyleSelector
See Remarks
Inheritance
StyleSelector
Attributes
Windows.Foundation.Metadata.ComposableAttribute Windows.Foundation.Metadata.ContractVersionAttribute Windows.Foundation.Metadata.MarshalingBehaviorAttribute Windows.Foundation.Metadata.ThreadingAttribute Windows.Foundation.Metadata.WebHostHiddenAttribute

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