How to detect text and search a location over mapview?

I added mapview using xamarin.forms.maps package. I wanted to add a searchbar field to search address and drop pin using search box.

How to add a SearchBar programmatically a search a location?

I tried the following:

var searchField = new SearchBar
{
Placeholder = "Enter search term"
};
searchField.SearchCommand = new Command(() => { if (searchField != null) { string.Format("Result: {0} is what you asked for.", searchField.Text); }
** // I don't get the text here**

Content = new StackLayout
{
Spacing = 0,
Children = {
searchField,
map,
buttons
}
};

Best Answers

  • deepak4218deepak4218 ✭✭
    Accepted Answer

    This answer gave me the lead to solve what I was looking for. And this answer finally solved my problem.

Answers

Sign In or Register to comment.