Forum Cross Platform with Xamarin

Search bar not working in windows phone 8.1

I am developing cross platform app(PCL) in that I have used search bar for listview. It works fine in IOS but windows it does not work properly. Actually the search bar text passed as empty. How can i solve this problem kindly help me.


  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    Could you please share some details?
    Show us what code or XAML you use to create the searchbar and how you get the actual text in your code-behind?

  • aarthidlaarthidl USMember ✭✭

    scrPlan = new SearchBar () {
    Placeholder = "Search",
    BackgroundColor = Color.Transparent,

            scrPlan.TextChanged += (sender, e) => FilterPlans (scrPlan.Text);
            scrPlan.SearchButtonPressed += (sender, e) => FilterPlans (scrPlan.Text);
  • aarthidlaarthidl USMember ✭✭

    public void FilterPlans (string filter)
    lstView.BeginRefresh ();

            if (string.IsNullOrWhiteSpace (filter)) {
                lstView.ItemsSource = planList;
            } else {
                lstView.ItemsSource = planList
                    .Where (x => x.PlanName.ToLower ()
                        .Contains (filter.ToLower ()));
            lstView.EndRefresh ();
  • aarthidlaarthidl USMember ✭✭

    In that fileterPlans ** function I can't access the string value of **filter. which happens only in windows phone. IOS its working fine

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    Is the value just empty? Of do you get any exceptions?

  • aarthidlaarthidl USMember ✭✭

    I didn't get any exception, its simply empty.

Sign In or Register to comment.