Vixen
dd8b0a81

AccessibilityTreeSource

class Core/Vixen.Ui/AccessibilityTree.cs:383
csharp
public sealed class AccessibilityTreeSource

Captures the accessibility tree, frame after frame, with node ids that stay put.

Read the guide page for this →

Remarks

The mutable half, deliberately separated from the immutable one. An AccessibilityTree is a frame that has already happened and can be read from any thread; this is the map from live elements to node ids, and it belongs to the thread that owns the document, like everything else in Vixen.Ui.

⚠ An id is never handed out twice. A removed element's id is retired rather than recycled, so a bridge holding a stale reference to node 41 gets nothing back rather than someone else's button. That is what makes the platform objects a bridge keeps — AXUIElements, UIA providers — safe to key on the id.

Usage is one call from AccessibilityInvalidated: Capture for the new tree, and Changes for what to post.

Fields and properties (2)

  • public AccessibilityTree? Tree

    The most recent capture, or null before the first one.

  • public IReadOnlyList<AccessibilityChange> Changes

    What the most recent Capture changed, against the one before it.

Methods (2)

  • public AccessibilityTree Capture(UiElement root)

    Captures the accessibility tree under an element, and diffs it against the last one.

  • public void Reset()

    Forgets every id, so the next capture is a fresh tree.

Used by (2)

  • AccessibilityTreeVixen.Ui
  • AccessibilityTreeTestsVixen.Ui.Tests