AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.06k stars 2.25k forks source link

Search all SelectingItemsControl items with TextSearch on key input, not just realized ones #17506

Open jonko0493 opened 1 week ago

jonko0493 commented 1 week ago

What does the pull request do?

This PR brings the behavior of SelectingItemControls with VirtualizingPanel presenters into parity with those controls without virtualizing presenters.

What is the current behavior?

Currently, SelectingItemsControls with VirtualizingPanel item presenters (such as ComboBox) do not search the full contents of their boxes with text search, only the currently realized controls. This means ~that if a ComboBox is closed, typing does nothing, and even when opened,~ (this was slightly wrong!) it will only jump to items immediately in the popup.

What is the updated/expected behavior with this PR?

Now, ComboBoxes and other SelectingItemsControls with virtualizing presenters will have proper TextSearch for their entire item sets.

How was the solution implemented (if it's not obvious)?

The anonymous method that existed in the SelectingItemsControl class previously has been moved into a static method in ItemsPresenter. It's now used there and in VirtualizingPanel to check search their items/children for text search. (Note: I don't know if there is a preferred place for a static method like this; happy to move as appropriate.)

Unit test case was added to an existing test and the test was adapted so that ComboBoxes in tests will use a VirtualizingStackPanel like the real controls do to ensure the tests fail without this change.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #12490.

avaloniaui-bot commented 1 week ago

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

cla-avalonia commented 1 week ago
jonko0493 commented 1 week ago

@cla-avalonia agree

jonko0493 commented 1 week ago

Everything was passing prior to me merging master... not sure what changed, could be transient failures?

timunie commented 1 week ago

@jonko0493 don't worry tests are a bit flaky atm

avaloniaui-bot commented 1 week ago

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