xamarin.forms - Implementation of OnSearchBarButtonPressed in the ListView in Xamarin Form -
is there way search name on table(listview) in xamarin form without using monotouch components - crossplatform?
i have number of names , populated on listview , want 1 time user types name , listview sorted , should bring matched name. have added searchbar @ top of listview.
i not know how implement onsearchbarbuttonpressed method. believe should not reinvent wheel again.
searchbar searchbar = new searchbar { placeholder = "search employee name", }; searchbar.searchbuttonpressed += onsearchbarbuttonpressed; padding = new thickness (10, 20, 10, 10); content = new stacklayout () { children={searchbar,listview} };
in relation other posting here listview itemssource collection of objects.
the listview command has no way of knowing model , wouldn't able filtering itself.
there appears nil inbuilt listview allow specify predicate help task anyway.
you should hence filtering in searchbar.searchbuttonpressed , re-assign listview itemssource reflect newly filtered itemssource want show end-user. filtering logic wanted able customize filter on many fields etc.
the searchbar.searchbuttonpressed event assign eventhandler, doing. need fill in filtering logic , update listview accordingly.
xamarin xamarin.forms
No comments:
Post a Comment