microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.32k stars 676 forks source link

Proposal: Feature parity between UWP's and WPF's ToolTipService class #2262

Open Felix-Dev opened 4 years ago

Felix-Dev commented 4 years ago

Proposal: Feature parity between UWP's and WPF's ToolTipService class

Summary

Currently, UWP's ToolTipService class lacks many of the attached properties of WPF's ToolTipService class. Here's a list of the missing APIs:

Rationale

Currently, some ToolTip tasks for UWP developers are more cumbersome than they need to be, especially compared to WPF. If, for example, you want to increase the ShowDuration time of a tooltip in UWP you currently need to do something like this (quote from @Aminator):

You need to subscribe to the Closed event and then set the IsOpen property to true to keep it open. Then after some time you can set IsOpen to false to close it.

In WPF, it's as easy as:

ToolTipService.ShowDuration=5000 // set the duration time to 5 seconds

Thus, addding these properties to the UWP version will greatly improve the developer experience and productivity.

Furthermore, with WinUI Desktop, the goal is to attract - among others - WPF developers. Many such developers who currently make use of these poperties will have to write additional code or create workarounds where possible. To ease porting from WPF to WinUI Desktop API gaps like these should be minimized.

Scope

Capability Priority
Have UWP's ToolTipService class match WPF's ToolTipService class. Must

Open Questions

Do all properties need to be ported over from WPF to UWP? For example, what about the HasDropShadow API?

sylveon commented 3 years ago

I am also blocked by this. Currently I am porting some Win32 code, and I need to show a tooltip when a MenuFlyout item is disabled but hovered (so ShowOnDisabled), so I can't use the usual workarounds of "put a with the tooltip rectangle over it" because MenuFlyout only takes MenuFlyoutItemBase items.

hawkerm commented 3 years ago

This is also compounded by #3521 as well because continuing to hover over the item or the tooltip doesn't keep it onscreen. If you have just a bit too much text in the tooltip, you can't have it left open for a user to read.

yaira2 commented 1 year ago

I came across this issue when searching for a way to use InitialShowDelay, missing these properties means that we'll have to create a custom control with this behavior.

michael-hawker commented 3 months ago

Was replying to this WPF request here as Binding covers it; however, I was mocking up my example in XAML Studio with WinUI and realized that the solution for showing the Tooltip in WPF with ShowOnDisabled doesn't have an equivalent for WinUI yet...