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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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 priority 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]

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

Successfully merging this pull request may close these issues.

3 participants