Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9204489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:43:22+00:00 2026-06-17T23:43:22+00:00

When I enable the ScopeBar and wire up the SelectedScopeButtonIndexChanged on a Monotouch.Dialog control,

  • 0

When I enable the ScopeBar and wire up the SelectedScopeButtonIndexChanged on a Monotouch.Dialog control, the automatic search feature that is enabled when you set EnabledSearch=true is disabled.

Here’s how it becomes disabled:

     UISearchBar sb = SearchBar;
     if (sb != null)
     {
        sb.ScopeButtonTitles = new string[] { "Girl".t(),"Boy".t(),"All".t() };
        sb.ShowsScopeBar = true;
        sb.SizeToFit();
        // THIS NEXT LINE KILLS SEARCH, remove to make it all work again
        sb.SelectedScopeButtonIndexChanged+= (sender, e) => {Update();};
     }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:43:23+00:00Added an answer on June 17, 2026 at 11:43 pm

    The reason that this breaks searching is because DialogViewController assigns a custom UISearchBarDelegate on the UISearchBar.

    When you connect to an event, that clobbers the Delegate and replaces it with a special UISearchBarDelegate that forwards all delegate methods to events.

    In other words, you cannot mix and match delegates with events on the same control.

    One possible solution (if you don’t want to patch MonoTouch.Dialog itself), is to replace the existing sb.Delegate with your own custom UISearchBarDelegate which could implement the SearchScope methods and forward everything else to the UISearchBarDelegate that was already set previously.

    for example:

    public class MySearchBarDelegate : UISearchBarDelegate
    {
        UISearchBarDelegate original;
        MyDialogViewController dvc;
    
        public MySearchBarDelegate (MyDialogViewController dvc, UISearchBarDelegate original)
        {
            this.original = original;
        }
    
        public override void SelectedScopeButtonIndexChanged (UISearchBar searchBar, int selectedScope)
        {
            dvc.Update ();
        }
    
        public override void OnEditingStarted (UISearchBar searchBar)
        {
            original.OnEditingStarted (searchBar);
        }
    
        public override void OnEditingStopped (UISearchBar searchBar)
        {
            original.OnEditingStopped (searchBar);
        }
    
        public override void TextChanged (UISearchBar searchBar, string searchText)
        {
            original.TextChanged (searchBar, searchText);
        }
    
        public override void CancelButtonClicked (UISearchBar searchBar)
        {
            original.CancelButtonClicked (searchBar);
        }
    
        public override void SearchButtonClicked (UISearchBar searchBar)
        {
            original.SearchButtonClicked (searchBar);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am trying to enable feature in the Project Web App. Actually, am trying to
The enable_shared_from_this helper contains a weak pointer that is set when creating shared pointer
I Enable This Feature in my .htaccess file, to speed up the image load
I enable them by pressing: M-x linum-mode . How can I translate that into
To enable full text search, I ever used hibernate-search and solrJ, No I am
How to enable textarea tags in HTMLPurifier ? I tried with: $config->set('HTML.Allowed', 'textarea'); But
According to Enable and Control DWM Composition : Note As of Windows 8, the
I want to enable some error report in my app, for that I am
To enable single sign-on for a web application and a web application in a
By enable the option called Application supports iTunes file sharing , I can integrate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.