BinaryRibbonScreenTipService
class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Office
Attaches a BinaryRibbonScreenTip to a command, with the timing and placement a ribbon
command wants.
public static class BinaryRibbonScreenTipService
Remarks
A screen tip assigned to FrameworkElement.ToolTip directly will show. Setting it
through SetScreenTip does that and sets three more things on the element, through
ToolTipService:
- the tip shows while the command is disabled, which is when a user most needs telling why;
- it appears after half a second and stays up to 30 seconds, long enough to read a title, a description and a footer – WPF's own default is five seconds;
- it appears below the command, where Office puts it, rather than at the pointer.
Removing the screen tip (setting null) clears the tool tip and these settings
again.
Examples
<bm:BinaryRibbonButton Content="Approve" LargeImage="Images/Approve32.png" Click="OnApprove">
<bm:BinaryRibbonScreenTipService.ScreenTip>
<bm:BinaryRibbonScreenTip Title="Approve invoice"
Description="Mark the invoice as approved and ready to send." />
</bm:BinaryRibbonScreenTipService.ScreenTip>
</bm:BinaryRibbonButton>BinaryRibbonScreenTipService.SetScreenTip(approveButton, new BinaryRibbonScreenTip
{
Title = "Approve invoice",
Description = "Mark the invoice as approved and ready to send.",
DisabledDescription = "Only a manager can approve an invoice."
});See also
Members at a glance
| Methods | |
|---|---|
GetScreenTip | Gets the screen tip attached to an element. |
SetScreenTip | Attaches a screen tip to an element, as its tool tip, with the ribbon's timing and placement. |
| Fields | |
ScreenTipProperty | Identifies the ScreenTip attached property. |
Methods
GetScreenTip static
public static BinaryRibbonScreenTip GetScreenTip(DependencyObject element)
Gets the screen tip attached to an element.
Parameters
element- The element.
Returns
The screen tip, or null when it has none or element is
null.
SetScreenTip static
public static void SetScreenTip(DependencyObject element, BinaryRibbonScreenTip value)
Attaches a screen tip to an element, as its tool tip, with the ribbon's timing and placement.
Parameters
element- The element. Ignored when
null; only aFrameworkElementgets the tip. value- The screen tip, or
nullto remove it, which also clears the element's tool tip and tool tip settings.
Fields
ScreenTipProperty static
public static readonly DependencyProperty ScreenTipProperty
Identifies the ScreenTip attached property.