xamarin.forms - Best practice in Xamarin Forms to perform a filter search -
i need perform filter search dynamic fields , not sure best way this.
we have lot of documents different fields , these used filter search.
can point me in right direction?
if using mvvm pattern. here steps:
- declare
observablecollection<itemtype>
each of drop down lists in viewmodel. - create
selectedtype1, selectedtype2
etc. properties selected values corresponding each drop down list. - attach selectionchanged , textchanged method handlers each drop down lists in view updates corresponding selection properties in viewmodel.
- delcare
observablecollection<searchresulttype> searchresults
in viewmodel holds search results given search. - declare
searchcommand
property in viewmodel executessearch
method. - declare
search
method makes web request call or local database search query depending on requirement. search method has access drop down selections/text typed user. - insert results obtained in search method
searchresults
collection. - bind
searchresults
collectionlistview.itemssource
in view. - bind
searchcommand
search action button (top right button in view).
happy coding!
Comments
Post a Comment