Class ThemeVariant
Specifies a UI theme variant that should be used for the Control and Application types.
[TypeConverter(typeof(ThemeVariantTypeConverter))]
public sealed record ThemeVariant : IEquatable<ThemeVariant>
- Inheritance
-
ThemeVariant
- Implements
- Inherited Members
Constructors
ThemeVariant(object, ThemeVariant?)
Creates a new instance of the ThemeVariant
public ThemeVariant(object key, ThemeVariant? inheritVariant)
Parameters
key
objectKey of the theme variant by which variants are compared.
inheritVariant
ThemeVariantReference to a theme variant which should be used, if resource wasn't found for the requested variant.
Exceptions
- ArgumentException
Thrown if inheritVariant is a reference to the Default which is ambiguous value to inherit.
- ArgumentNullException
Thrown if key is null.
Properties
Dark
Use the Dark theme variant.
public static ThemeVariant Dark { get; }
Property Value
Default
Inherit theme variant from the parent. If set on Application, system theme is inherited. Using Default as the ResourceDictionary.Key marks this dictionary as a fallback in case the theme variant or resource key is not found in other theme dictionaries.
public static ThemeVariant Default { get; }
Property Value
InheritVariant
Reference to a theme variant which should be used, if resource wasn't found for the requested variant.
public ThemeVariant? InheritVariant { get; }
Property Value
Key
Key of the theme variant by which variants are compared.
public object Key { get; }
Property Value
Light
Use the Light theme variant.
public static ThemeVariant Light { get; }
Property Value
Methods
Equals(ThemeVariant?)
public bool Equals(ThemeVariant? other)
Parameters
other
ThemeVariant
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(ThemeVariant?, ThemeVariant?)
public static bool operator ==(ThemeVariant? left, ThemeVariant? right)
Parameters
left
ThemeVariantright
ThemeVariant
Returns
explicit operator ThemeVariant(PlatformThemeVariant)
public static explicit operator ThemeVariant(PlatformThemeVariant themeVariant)
Parameters
themeVariant
PlatformThemeVariant
Returns
explicit operator PlatformThemeVariant?(ThemeVariant)
public static explicit operator PlatformThemeVariant?(ThemeVariant themeVariant)
Parameters
themeVariant
ThemeVariant
Returns
operator !=(ThemeVariant?, ThemeVariant?)
public static bool operator !=(ThemeVariant? left, ThemeVariant? right)
Parameters
left
ThemeVariantright
ThemeVariant