dotnet / dotnet/maui

SearchBar: Execute SearchCommand when .Text == ""

Open
#8,994 9 comments 17 reactions 1 assignee Assigned to @Copilot View on GitHub
area-controls-entry platform/android proposal/open
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

### Description

currently SearchBar.SearchCommand is not executed when the text == "", however for use case where the SearchBar is used to filter what's display in a list (e.g. CollectionView), when user clear the search bar, it is expected to display the full list. however this can't be achieved currently using SearchCommand.

there is a workaround is to use TextChanged event, however it would be nicer to have SearchCommand also fired with empty string.

### Public API Changes

API change is optional, maybe a knob to enable such behavior, but it is not mandatory from my point of view

### Intended Use-Case

see the description above

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.