Skip to content
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

Prevent AutoCompleteBox getting stuck in a state where it can't drop down. #17074

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

grokys
Copy link
Member

@grokys grokys commented Sep 20, 2024

What does the pull request do?

AutoCompleteBox sometimes can get stuck in a state where it can't get dropped down. A customer reported this, giving the use case where they set IsDropDownOpen (via a binding) before they set ItemsSource (also via a binding).

This happens because AutoCompleteBox.RefeshView has two state flags: _filterInAction and _cancelRequested. Usually these are reset when the method exits but in the case where there are no items, the method exits early leaving _filterInAction set to true.

Wrap the whole thing in a try...finally block to make sure the flags are always reset when the method exits, even if there are exceptions etc.

Note: the diff is best viewed using the Hide whitespace option on GitHub as the whole block has changed indentation.

Wrap everything in a `try`...`finally` block so that they get reset even on exception.
@grokys grokys added bug customer-priority Issue reported by a customer with a support agreement. backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch and removed backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Sep 20, 2024
@avaloniaui-bot
Copy link

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

@maxkatz6 maxkatz6 added this pull request to the merge queue Sep 24, 2024
Merged via the queue into master with commit b8d8fda Sep 24, 2024
12 checks passed
@maxkatz6 maxkatz6 deleted the fixes/autocompletebox-cant-drop-down branch September 24, 2024 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug customer-priority Issue reported by a customer with a support agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants