Xamarin – SearchBar Tip 1

If you’re using a SearchBar control, you’ll need to pass the text that’s been entered. Instead of using a property you can use a Binding “trick” instead.

<SearchBar x:Name="MySearchBar" SearchCommand="{Binding SearchCommand}" SearchCommandParameter="{Binding Text, Source={x:Reference MySearchBar}}" />

You’ll notice that SearchCommandParameter is set to bind to the text property of the SearchBar itself

Leave a Reply

Your email address will not be published. Required fields are marked *