The ResourceKey value for each StaticResource references a brush and color in the Common_themeresources_any.xaml file. WinUI Styles (recommended): When you use the updated styles from WinUI 2.6 or later, the resources for this control are listed in the ThemeDictionaries section of the ToolTip_rs5_themeresources.xaml file on GitHub. For more info, see the Light-weight styling section of the XAML styles article. Modifying these resources is preferred to setting properties such as Background and Foreground. XAML also includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. For information about modifying a control's style and template, see XAML styles. You can modify the default Style and ControlTemplate to give the control a unique appearance. You can set the VerticalOffset and HorizontalOffset properties to change the distance between the pointer and the ToolTip. Use the Placement property or ToolTipService.Placement attached property to place the ToolTip above, below, left, or right of the pointer. If a ToolTip obscures the content it is referring to, you can adjust its placement. The placement is not constrained by the app window, so the ToolTip might be displayed partially or completely outside of the app window bounds. īy default, a ToolTip is displayed centered above the pointer. Here's an example of using an Image in a ToolTip. You can use any object as the Content of a ToolTip. ToolTipService.SetToolTip(submitButton, toolTip) In code, use the ToolTipService.SetToolTip method to assign the ToolTip to an owner.In XAML, use the ToolTipService.Tooltip attached property to assign the ToolTip to an owner.The ToolTipService class provides static methods to display a ToolTip. ![]() UsageĪ ToolTip must be assigned to another UI element that is its owner. ![]() Starting with Windows 11 version 21H2, a tooltip can also be dismissed by pressing the CTRL key.įor design guidelines, see Guidelines for tooltips. The tooltip disappears when the user moves focus from, stops pressing on, or stops hovering the pointer over the associated control (unless the pointer is moving towards the tooltip). Tooltips display automatically when the user moves focus to, presses and holds, or hovers the pointer over the associated control. Ī tooltip is a popup that contains additional information about another control or object. This example demonstrates basic tooltips and the properties for placement. Get the app from the Microsoft Store or get the source code on GitHub. ![]() The WinUI 2 Gallery app includes interactive examples of most WinUI 2 controls, features, and functionality. Open the WinUI 2 Gallery app and see the Tooltip in action
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |