TeachingTip
- Assembly:
Fluence.Wpf - Namespace:
Fluence.Wpf.Controls
public class TeachingTip : ContentControl
A contextual tip surface with a title, subtitle, body content, and optional action and close buttons, mirroring the WinUI 3 TeachingTip control. The tip is hosted in an internal light-weight Popup: when Target is set the popup is anchored to it, centered on the target edge selected by PreferredPlacement; untargeted tips dock to the bottom-right corner of the active window content (or center when PreferredPlacement is explicitly Center) and hide the beak. The body uses the inherited Content and ContentTemplate.
Base type: ContentControl (including inherited WPF and .NET members)
Constructors
TeachingTip
public TeachingTip()
Initializes a new instance of the TeachingTip class. The tip starts collapsed so a tip declared in page XAML renders nothing inline; it becomes visible once it is re-hosted in its popup the first time it opens. SetCurrentValue keeps an explicit consumer-set Visibility authoritative. The open reveal subscribes to Loaded: the popup child re-raises Loaded on every open, so the reveal replays each time the tip shows.
Properties
ActionButtonCommand
public ICommand? ActionButtonCommand { get; set; }
Gets or sets the command executed when the action button is invoked, after the ActionButtonClick event has been raised.
ActionButtonCommandParameter
public object? ActionButtonCommandParameter { get; set; }
Gets or sets the parameter passed to ActionButtonCommand.
ActionButtonContent
public object? ActionButtonContent { get; set; }
Gets or sets the content of the accent action button in the tip footer. The button is collapsed while the value is null.
ActualPlacement
public TeachingTipPlacementMode ActualPlacement { get; }
Gets the placement the tip resolved when it was last opened: PreferredPlacement with Auto resolved to a concrete edge, or Center for untargeted tips (which dock to the bottom-right corner of the window content but never show a beak). The template positions the beak on the edge facing the target and hides it for Center.
CloseButtonContent
public object? CloseButtonContent { get; set; }
Gets or sets the content of the close button in the tip footer, matching the WinUI close-affordance rules: the footer close button shows only while this value is set. While it is null and IsLightDismissEnabled is false, an alternate X close button is shown in the top-right corner of the tip instead; while it is null and light dismiss is enabled, the tip shows no close affordance at all.
IsLightDismissEnabled
public bool IsLightDismissEnabled { get; set; }
Gets or sets a value indicating whether clicking outside the tip dismisses it. Maps to the inverse of StaysOpen on the host popup.
IsOpen
public bool IsOpen { get; set; }
Gets or sets a value indicating whether the tip is open. Setting true shows the tip in its host popup; setting false (or a light dismiss) closes it and raises Closed.
PreferredPlacement
public TeachingTipPlacementMode PreferredPlacement { get; set; }
Gets or sets where the tip opens relative to Target. When a target is set, Auto currently resolves to Bottom. When Target is null, an untargeted Auto tip docks to the bottom-right corner of the window content (the WinUI default position); any other explicit value centers the tip over the window content.
Subtitle
public string Subtitle { get; set; }
Gets or sets the subtitle shown beneath Title. The subtitle is hidden while the value is empty.
Target
public FrameworkElement? Target { get; set; }
Gets or sets the element the tip is anchored to. When null the tip centers over the active window content and the beak is hidden.
Title
public string Title { get; set; }
Gets or sets the title shown at the top of the tip. The title is hidden while the value is empty.
Methods
OnApplyTemplate
public override void OnApplyTemplate()
Documentation inherited from the ContentControl API.
OnCreateAutomationPeer
protected override AutomationPeer OnCreateAutomationPeer()
Documentation inherited from the ContentControl API.
OnPreviewKeyDown
protected override void OnPreviewKeyDown(KeyEventArgs e)
Documentation inherited from the ContentControl API.
Remarks: Escape pressed inside the open tip dismisses it, mirroring the WinUI keyboard contract, which treats Escape as a light dismiss. The close runs through the IsOpen pipeline so Closed is raised as usual, and the reason is staged so it reports LightDismiss rather than the default Programmatic.
Events
ActionButtonClick
public event EventHandler? ActionButtonClick
Occurs when the action button is invoked, before ActionButtonCommand executes. Invoking the action button does not close the tip.
CloseButtonClick
public event EventHandler? CloseButtonClick
Occurs when the close button is invoked, before the tip closes.
Closed
public event EventHandler<TeachingTipClosedEventArgs>? Closed
Occurs after the tip has closed, whether through IsOpen, the close button, or a light dismiss.
Dependency property identifiers
Use these identifiers with WPF property APIs. The matching CLR properties appear above when the control exposes them.
ActionButtonCommandParameterProperty
public static readonly DependencyProperty ActionButtonCommandParameterProperty
Identifies the ActionButtonCommandParameter dependency property.
ActionButtonCommandProperty
public static readonly DependencyProperty ActionButtonCommandProperty
Identifies the ActionButtonCommand dependency property.
ActionButtonContentProperty
public static readonly DependencyProperty ActionButtonContentProperty
Identifies the ActionButtonContent dependency property.
ActualPlacementProperty
public static readonly DependencyProperty ActualPlacementProperty
Identifies the ActualPlacement dependency property.
CloseButtonContentProperty
public static readonly DependencyProperty CloseButtonContentProperty
Identifies the CloseButtonContent dependency property.
IsLightDismissEnabledProperty
public static readonly DependencyProperty IsLightDismissEnabledProperty
Identifies the IsLightDismissEnabled dependency property.
IsOpenProperty
public static readonly DependencyProperty IsOpenProperty
Identifies the IsOpen dependency property.
PreferredPlacementProperty
public static readonly DependencyProperty PreferredPlacementProperty
Identifies the PreferredPlacement dependency property.
SubtitleProperty
public static readonly DependencyProperty SubtitleProperty
Identifies the Subtitle dependency property.
TargetProperty
public static readonly DependencyProperty TargetProperty
Identifies the Target dependency property.
TitleProperty
public static readonly DependencyProperty TitleProperty
Identifies the Title dependency property.