Controls, UI, Xamarin

Let’s use the SearchBar control in Xamarin Forms

This time I will tell you about the SearchBar, which is a control that allows us make a search of a specific information between a set of these. To understand better, I will be display these topics in the following sets:

? SearchBar basic structure

? Implementing SearchBar Page


Let’s start!!!

SearchBar basic structure

To understand better, is important to know the basic structure needed to the SearchBar control. In the image showed below, I display an example of how we can begin using it and one of the most important events in my opinion. (Just giving life to the example ?).

This control has a lot of great events and properties, here I will be explain some of my favorites:

?SearchButtonPressed: This event is triggered when the search button is pressed. (As indicated in the image)

?SearchBarCommand: It’s the command that gets executed when the search button is pressed.

?TextChanged: Even though this event isn’t exclusive to this control, I added it in this explanation because is one of the most useful when creating search page. This event is triggered while we are writing a text.


Implementing SearchBar Page

 

And now, let’s create an example! Let’s see the XAML implementation:

The c# code: Creating a list

The method to search the information into the list:

Done!!! The SearchBar is implemented?

You can read more information about the SearchBar control here.

Thanks for reading!!! ?

Spanish post: https://medium.com/@reyes.leomaris/usando-la-barra-de-búsqueda-searchbar-en-xamarin-forms-b12d3403ca54

Tagged , , , ,

3 thoughts on “Let’s use the SearchBar control in Xamarin Forms

  1. Would you recommend what software to use create my blog. Will appreciate that

    THanks

    Alex

Leave a Reply

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