Class StyledProperty<TValue>
- Namespace
- Avalonia
- Assembly
- Avalonia.Base.dll
A styled avalonia property.
public class StyledProperty<TValue> : AvaloniaProperty<TValue>, IEquatable<AvaloniaProperty>, IPropertyInfo
Type Parameters
TValue
- Inheritance
-
AvaloniaProperty<TValue>StyledProperty<TValue>
- Implements
- Derived
- Inherited Members
Properties
ValidateValue
A method which returns "false" for values that are never valid for this property.
public Func<TValue, bool>? ValidateValue { get; }
Property Value
Methods
AddOwner<TOwner>(StyledPropertyMetadata<TValue>?)
Registers the property on another type.
public StyledProperty<TValue> AddOwner<TOwner>(StyledPropertyMetadata<TValue>? metadata = null) where TOwner : AvaloniaObject
Parameters
metadata
StyledPropertyMetadata<TValue>
Returns
- StyledProperty<TValue>
The property.
Type Parameters
TOwner
The type of the additional owner.
CoerceValue(AvaloniaObject, TValue)
public TValue CoerceValue(AvaloniaObject instance, TValue baseValue)
Parameters
instance
AvaloniaObjectbaseValue
TValue
Returns
- TValue
GetDefaultValue(AvaloniaObject)
Gets the default value for the property on the specified object.
public TValue GetDefaultValue(AvaloniaObject owner)
Parameters
owner
AvaloniaObjectThe object.
Returns
- TValue
The default value.
GetDefaultValue(Type)
Gets the default value for the property on the specified type.
public TValue GetDefaultValue(Type type)
Parameters
type
TypeThe type.
Returns
- TValue
The default value.
Remarks
For performance, prefer the GetDefaultValue(AvaloniaObject) overload when possible.
GetMetadata(AvaloniaObject)
Gets the AvaloniaPropertyMetadata which applies to this property when it is used with the specified object.
public StyledPropertyMetadata<TValue> GetMetadata(AvaloniaObject owner)
Parameters
owner
AvaloniaObjectThe object for which to retrieve metadata.
Returns
- StyledPropertyMetadata<TValue>
GetMetadata(Type)
Gets the AvaloniaPropertyMetadata which applies to this property when it is used with the specified type.
public StyledPropertyMetadata<TValue> GetMetadata(Type type)
Parameters
type
TypeThe type for which to retrieve metadata.
Returns
- StyledPropertyMetadata<TValue>
Remarks
For performance, prefer the GetMetadata(AvaloniaObject) overload when possible.
OverrideDefaultValue(Type, TValue)
Overrides the default value for the property on the specified type.
public void OverrideDefaultValue(Type type, TValue defaultValue)
Parameters
type
TypeThe type.
defaultValue
TValueThe default value.
OverrideDefaultValue<T>(TValue)
Overrides the default value for the property on the specified type.
public void OverrideDefaultValue<T>(TValue defaultValue) where T : AvaloniaObject
Parameters
defaultValue
TValueThe default value.
Type Parameters
T
The type.
OverrideMetadata(Type, StyledPropertyMetadata<TValue>)
Overrides the metadata for the property on the specified type.
public void OverrideMetadata(Type type, StyledPropertyMetadata<TValue> metadata)
Parameters
type
TypeThe type.
metadata
StyledPropertyMetadata<TValue>The metadata.
OverrideMetadata<T>(StyledPropertyMetadata<TValue>)
Overrides the metadata for the property on the specified type.
public void OverrideMetadata<T>(StyledPropertyMetadata<TValue> metadata) where T : AvaloniaObject
Parameters
metadata
StyledPropertyMetadata<TValue>The metadata.
Type Parameters
T
The type.
ToString()
Gets the string representation of the property.
public override string ToString()
Returns
- string
The property's string representation.