public static SearchBar BindSearchEvent(this SearchBar bar, string bindCommand, string bindText) { bar.Bind(SearchBar.SearchCommandProperty, bindCommand) .Bind(SearchBar.TextProperty, bindText) .BindEventCommand(new EventToCommandBehavior() { EventName = nameof(SearchBar.TextChanged), Command = new Command((obj) => { var txt = ((SearchBar)obj).Text; if (string.IsNullOrEmpty(txt)) { bar.SearchCommand?.Execute(null); } }) }); return(bar); }