-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add property to allow mouse triggering on release behavior for item selection #20356
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
base: master
Are you sure you want to change the base?
Add property to allow mouse triggering on release behavior for item selection #20356
Conversation
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
|
Notes from the API review meeting: We aren't sure we want this in the core framework. It's now quite easy for an user to customize the behavior thanks to the new virtual methods (or by marking the mouse down event as handled in this specific case). The availability of this extensibility points means we don't want to add new properties for every possible combination of mouse/pen/touch inputs and press/release behaviors. Plus, the scenario described in the OP ("item as button") can also be done with the items being buttons themselves. Do you have a use case that couldn't be easily done (or be very cumbersome) with the existing extensibility points? |
|
I mainly wanted this in to make uniformity between buttons and list boxes. We got feedback in our app that select on press for list and combo boxes, but select on release for buttons was jarring and a confusing user experience. Maybe that should be a separate discussion, changing the default to match what buttons do by default (and most other frameworks are select on release for list boxes anyway) I’ve also had issues in the past with styles not applying properly with subclassing. Probably a skill issue, but if that’s the extension point then how to do that properly needs to be better documented. |
|
You can test this PR using the following package version. |
What does the pull request do?
#19203 made it easier to adjust selection behavior for SelectingItemControls, and added uniform behavior handling. The existing behavior always uses select on press for mouse buttons, unless Gesture support is enabled. However, there are cases where select on release is useful, especially if you're using a list box as buttons, since default behavior for buttons is select on release.
What is the current behavior?
Only mouse select on press is supported, unless using gesture support (Which can have other side effects).
What is the updated/expected behavior with this PR?
You can set the MouseTriggerOnRelease property on the individual items of a SelectingItemsControl (Such as a ListBoxItem) to allow that item to be select on release instead of select on press. The control catalog project was updated with a new button to switch this mode for all items in the list.
How was the solution implemented (if it's not obvious)?
An attached property was added to the ItemSelectionEventTriggers class, and that property is read from ShouldTriggerSelection.
Checklist
Breaking changes
None
Obsoletions / Deprecations
None
Fixed issues
Fixes #20347