Vixen
02b45cc4
csharp
public sealed class Tooltip

A short label that appears beside something the pointer is resting on.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The delay needs a clock, and the document now has one. A tooltip waits half a second before appearing, and nothing here is told what time it is except through input events — which stop arriving precisely when the pointer is resting. So it subscribes to Ticked, which a host with a frame loop drives through Tick, the same clock GestureRecognizer uses for a long press.

⚠ A host that never ticks gets a tooltip that never appears. Tick is still public and a caller may drive it directly; what is gone is the arrangement where every application had to remember to. Which of "never" and "instantly" is the better failure is arguable — what is not is that the difference used to be a method call in somebody else's loop.

It is never focusable and never takes the pointer: pointer-events: none in the theme, so a tooltip that lands under the cursor does not immediately hide itself by taking the hover away from the thing it describes.

Fields and properties (4)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • public TimeSpan Delay
  • public string? Label

    What it says.

  • public static readonly UiPropertyKey DelayProperty

    Identity for Delay.

Methods (5)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • protected override void OnRemoved()
  • public void Attach(UiElement target)

    Attaches it to an element, so that hovering that element shows it.

  • public void Tick(TimeSpan now)

    Tells it what time it is, so that a pointer that has rested long enough shows it.

  • public void ClearDelay()

    Unsets Delay, so it takes its default or its ancestor's value again.

Used by (4)

  • OverlayInteractionTestsVixen.Ui.Controls.Tests
  • OverlayLifetimeTestsVixen.Ui.Controls.Tests
  • CompositorViewVixen.Editor.AssetEditors
  • InspectorRowsVixen.Editor.Inspector