Skip to main content

ITextViewComponent Interface

Definition​

Assembly:Avalonia.Controls.Documents
Package:Avalonia.Controls.Documents

Base interface for text view components that provide modular interaction functionality.

public interface ITextViewComponent

Remarks​

Text view components are modular pieces that handle specific interaction functionality (keyboard navigation, mouse selection, caret rendering, etc.).

The host controls the lifecycle: components are registered via Avalonia.Controls.Documents.Primitives.IInteractiveTextHost.RegisterComponent(Avalonia.Controls.Documents.Primitives.Components.ITextViewComponent) and receive Avalonia.Controls.Documents.Primitives.Components.ITextViewComponent.OnAttach(Avalonia.Controls.Documents.Primitives.IInteractiveTextHost)/Avalonia.Controls.Documents.Primitives.Components.ITextViewComponent.OnDetach callbacks when the host activates or deactivates them.

Methods​

NameDescription
OnAttachCalled by the host when this component should activate (subscribe to events, acquire resources).
OnDetachCalled by the host when this component should deactivate (unsubscribe from events, release resources).

OnAttach Method​

Called by the host when this component should activate (subscribe to events, acquire resources).

public void OnAttach(Avalonia.Controls.Documents.Primitives.IInteractiveTextHost host)

Parameters​

host Avalonia.Controls.Documents.Primitives.IInteractiveTextHost

The interactive text host that owns this component.

OnDetach Method​

Called by the host when this component should deactivate (unsubscribe from events, release resources).

public void OnDetach()

Properties​

NameDescription
IsAttachedGets whether this component is currently attached to a host.

IsAttached Property​

Gets whether this component is currently attached to a host.

public bool IsAttached { get; set; }