Shell.SearchHandler Missing SelectedItem Property

Sirn Hirmeza 41 Reputation points

197278-2022-04-28-02h28-30.png197331-2022-04-28-02h29-55.pngThe SelecetdItem property is missing in Shell.SearchHandler. When I added it manually,everything works fine except the hot reload. It shows an error that says the property "SelectedItem" does not have an accessible setter. The error code is XHR0013.
I am using .Net 6 and Xamarin.Form version
Below is the code I am using to set the search handler.
<SearchHandler ShowsResults="True"
Placeholder="Name, UPC"
Query="{Binding SearchQuery}"
ItemsSource="{Binding SearchItemsResult, Mode=TwoWay}"
SelectedItem="{Binding SelectedSearchItem, Mode=TwoWay}" // I added this line manually while the property does not exist within the Shell.SearchHandler properties.
ItemTemplate="{StaticResource ItemsSearchTemplate}">

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,002 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 16,461 Reputation points Microsoft Vendor


    As the tips says, the property "SelectedItem" does not have an accessible setter.

    The property SelectedItem is a read only property in SearchHandler, you could refer to SearchHandler.SelectedItem Property to get the details.

    That's the reason why the error occurs.

    Best Regards,

    Alec Liu.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful