StyleSelector.SelectStyle Method (Object, DependencyObject)
When overridden in a derived class, returns a Style based on custom logic.
Assembly: PresentationFramework (in PresentationFramework.dll)
The element to which the style will be applied.
Return ValueType: System.Windows.Style
Returns an application-specific style to apply; otherwise, null.
The following example shows how to define a ResourceKey for the StyleSelector. The namespc prefix maps to a CLR namespace and the corresponding assembly where the StyleSelector is defined. For more information, see XAML Namespaces and Namespace Mapping for WPF XAML.
For an example of how to create a selector to choose a defined style resource, see the implementation of DataTemplateSelector.SelectTemplate, which allows you to use custom logic to select a DataTemplate, based on a similar concept.
Available since 3.0