Docsv3.31.0
Back to API Reference
Class

SelectionChangingArgs

sealed

Vetoable payload of UniTextSelectable.SelectionChanging. Subscribers inspect Proposed and may set Cancel to true to block the selection change before it is applied.

Remarks

Reference type with a mutable Cancel flag —.NET CancelEventArgs pattern. A fresh instance is allocated per UniTextSelectable.SelectionChanging emission so subscribers can synchronously trigger another mutation from inside the handler (re-entrancy is safe). Veto fires only on user-driven mutations (click / move / extend / select-word etc.) — text-edit side effects use the internal non-vetoable path, so the selection hot path remains zero-alloc. Real use cases (P2.A atomic tokens, integrator-defined read-only ranges): block selection from landing inside an atomic pill, or constrain selection to stay within editable regions. Standard shouldX-pattern across UIKit (shouldChangeTextInRange), Web (beforeinput with preventDefault), WPF (PreviewKeyDown) — see D-010. UserEvent uses the same hierarchical strings as SelectionChangedArgs.UserEvent.
public TextSelection Proposed{ get; set }

Selection state that will be applied if not cancelled.

public string UserEvent{ get }

Hierarchical category string — see SelectionChangedArgs.

public bool Cancel{ get; set }

When set to true, the selection change is aborted; previous state is preserved and UniTextSelectable.SelectionChanged does not fire.