-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ToolTip.ShowOnDisabled
and ToolTip.ServiceEnabled
#14928
Added ToolTip.ShowOnDisabled
and ToolTip.ServiceEnabled
#14928
Conversation
e99a0e5
to
0496a14
Compare
The ApiCompat tool is complaining that three hit test methods no longer exist. I'm not sure how to fix that, because they do. I have added overloads which take an optional bool parameter, but the original method signature is still there, now defined like this: public static IInputElement? InputHitTest(this IInputElement element, Point p) => InputHitTest(element, p, true); |
@TomEdwardsEnscape Since you've extended the API you probably need to re-run the APICompat. Usually it will run automatically when you build the project but you may run it manually also https://github.com/AvaloniaUI/Avalonia/wiki/ApiCompat---Diffs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general though I think the disabling of the feature where the tooltip is hidden on pointer down was unintentional?
Nitpicking about naming: shouldn't these properties be
|
The names are carried over from WPF, but have drifted a little because they really ought be properties of WPF has these: I don't know if it makes sense to follow the "IsState" pattern here because neither of these are really properties of the target object. They are configuring how the the service behaves when processing the target object. But, I've not got any strong opinions here. |
cb7c092
to
daefe5c
Compare
You can test this PR using the following package version. |
ToolTipService now processes raw mouse input, to allow tooltips on disabled controls Updated tests and control catalog
daefe5c
to
f86870f
Compare
You can test this PR using the following package version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now. I think the naming makes sense, though I'll leave this open for a few days to get any further feedback in that area (it's Easter holidays anyway).
Regarding the naming, note that in .NET 4.8 there's also
No blockers here for me, just discussing, I know naming is hard :) |
What if ToolTip service were public and exposed same property names as WPF? It would look like this pseudocode:
|
Adding ToolTipService would be a bit confusing, when we already have some WPF ToolTipService members kept in ToolTip instead. |
ToolTipService now processes raw mouse input, to allow tooltips on disabled controls Updated tests and control catalog
ToolTipService
now processes raw mouse input, to allow tooltips on disabled controls. It is also now possible to disable the service entirely, to allow users to write their own logic for hiding and showing tooltips without interference from Avalonia.What is the current behavior?
Tooltip behaviour is currently linked to pointer events on the host control. These events are not raised at all if the control is disabled, so tooltips cannot be automatically opened on the control. It is also not possible to block a tooltip on an enabled control from opening automatically.
How was the solution implemented
ToolTipService
now subscribes to theInputManager.Process
event. I could have hadTopLevel
pass the events directly toToolTipService
and avoid this dependency, but that would mean that tooltip processing would not occur until either afterInputManager.PostProcess
or beforeInputManager.PreProcess
, both of which seem wrong.In order to support this subscription in unit tests, where multiple applications are constructed,
ToolTipService
is disposable. This is not relevant to real-world applications because normally only one instance can exist in a given process.Breaking changes
None
Obsoletions / Deprecations
None
Fixed issues
Fixes #3847