Shell.SearchHandler Missing SelectedItem Property

Sirn Hirmeza 41 Reputation points
2022-04-28T09:20:39.743+00:00

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 5.0.0.2401
Below is the code I am using to set the search handler.
<Shell.SearchHandler>
<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}">

    </SearchHandler>  
</Shell.SearchHandler>  
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,294 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 35,471 Reputation points Microsoft Vendor
    2022-04-29T02:05:05.01+00:00

    Hello,

    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