Skip to content

Conversation

@ThadHouse
Copy link

@ThadHouse ThadHouse commented Dec 25, 2025

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

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0061099-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0061111-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added needs-api-review The PR adds new public APIs that should be reviewed. feature labels Dec 29, 2025
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0061151-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0061211-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul
Copy link
Member

MrJul commented Jan 7, 2026

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?

@MrJul MrJul removed the needs-api-review The PR adds new public APIs that should be reviewed. label Jan 7, 2026
@ThadHouse
Copy link
Author

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.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0061293-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow switching ListBox to select on release instead of select on press

3 participants