-
Notifications
You must be signed in to change notification settings - Fork 239
Description
The section about consuming the SearchHandler is incomplete.
The section above declares a property to be used as the source of the search, but it is not declared in the mentioned section.
So the IList<Animal> is always null and the AnimalSearchHandler throws an exception.
According to the sample MAUI-App, the property is bound to a static list.
But I think the more common way is to bind to the same source as the page e.g. a page containing a CollectionView with animals and that is bound to a list in a ViewModel.
There is no sample provided for this scenario. I'm really struggling to get this scenario to work due to the sparse documentation of this.
The property:
public IList<Animal> Animals { get; set; }The sample code without binding to the property:
<ContentPage ...
xmlns:controls="clr-namespace:Xaminals.Controls">
<Shell.SearchHandler>
<controls:AnimalSearchHandler Placeholder="Enter search term"
ShowsResults="true"
DisplayMemberName="Name" />
</Shell.SearchHandler>
...
</ContentPage>Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 20d6b4f2-f620-90f4-19f4-89b369f71c41
- Version Independent ID: 20d6b4f2-f620-90f4-19f4-89b369f71c41
- Content: .NET MAUI Shell search - .NET MAUI
- Content Source: docs/fundamentals/shell/search.md
- Product: dotnet-mobile
- Technology: dotnet-maui
- GitHub Login: @davidbritch
- Microsoft Alias: dabritch