IPropertyAction Interface
Definition
Non-generic base interface for property actions.
public interface IPropertyAction
Remarks
This interface provides object-based access to property values, allowing UI controls like combo boxes to work without knowing the concrete value type. Prefer using Avalonia.Controls.Documents.Primitives.Actions.IPropertyAction<T> when the value type is known at compile time.
The generic interfaces Avalonia.Controls.Documents.Primitives.Actions.IPropertyAction<T> and Avalonia.Controls.Documents.Primitives.Actions.IBlockPropertyAction<T> provide default implementations for Avalonia.Controls.Documents.Primitives.Actions.IPropertyAction.GetValueAsObject(Avalonia.Controls.Documents.Primitives.ITextEditorHost), Avalonia.Controls.Documents.Primitives.Actions.IPropertyAction.SetValueAsObject(Avalonia.Controls.Documents.Primitives.ITextEditorHost,object), and Avalonia.Controls.Documents.Primitives.Actions.IPropertyAction.GetAvailableValuesAsObjects that delegate to their typed counterparts. Only Avalonia.Controls.Documents.Primitives.Actions.IPropertyAction.ClearValue(Avalonia.Controls.Documents.Primitives.ITextEditorHost) requires an explicit implementation because its behavior varies per action type.
Methods
| Name | Description |
|---|---|
| ClearValue | Clears the property value for the selection, reverting affected elements to their inherited or default value. |
| GetAvailableValuesAsObjects | Gets the available values for this property as objects. |
| GetValueAsObject | Gets the current property value for the selection as an object. |
| SetValueAsObject | Sets the property value for the selection from an object. |
ClearValue Method
Clears the property value for the selection, reverting affected elements to their inherited or default value.
public void ClearValue(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)
Parameters
host Avalonia.Controls.Documents.Primitives.ITextEditorHost
The editor host to modify.
GetAvailableValuesAsObjects Method
Gets the available values for this property as objects.
public System.Collections.IEnumerable GetAvailableValuesAsObjects()
Returns
System.Collections.IEnumerable
An enumerable of available values for combo box population, or null if the values should be determined by the UI.
GetValueAsObject Method
Gets the current property value for the selection as an object.
public object GetValueAsObject(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)
Parameters
host Avalonia.Controls.Documents.Primitives.ITextEditorHost
The editor host to query.
Returns
object
The property value, or null for mixed/empty values.
SetValueAsObject Method
Sets the property value for the selection from an object.
public void SetValueAsObject(Avalonia.Controls.Documents.Primitives.ITextEditorHost host, object value)
Parameters
host Avalonia.Controls.Documents.Primitives.ITextEditorHost
The editor host to modify.
value object
The value to apply.