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.

<br />
&lt;SearchBar x:Name=&quot;MySearchBar&quot; SearchCommand=&quot;{Binding SearchCommand}&quot; SearchCommandParameter=&quot;{Binding Text, Source={x:Reference MySearchBar}}&quot; /&gt;<br />

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 *

This site uses Akismet to reduce spam. Learn how your comment data is processed.