Bug 5953 - MonoTouch.Dialog: Enabling ScopeButton on Search removes search events
Summary: MonoTouch.Dialog: Enabling ScopeButton on Search removes search events
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 5.2
Hardware: All Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-07-02 17:53 UTC by Ian
Modified: 2012-07-04 09:09 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ian 2012-07-02 17:53:05 UTC
I'm not sure if this is a bug.

In MonoTouch.Dialog enable the ScopeButton and wire up the Index Change event:

        UISearchBar sb = TableView.TableHeaderView as UISearchBar;
        sb.ScopeButtonTitles = new string[] { "Full Text".t(), "Titles".t() };
        sb.ShowsScopeBar = true;
        sb.SelectedScopeButtonIndexChanged += (sender, e) => {
Then over ride the Search Functions:

    public override void FinishSearch()
        //do nothing, leave the UI 

    public override void OnSearchTextChanged(string text)

    public override void SearchButtonClicked(string text)
         //Do nothing, leave the UI
The result is that the OnSearchTextChanged never fires.

If you remove the follow lines, it fires and works just fine.

//Remove to re-enable SearchButtonClicked
sb.SelectedScopeButtonIndexChanged += (sender, e) => {
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-07-04 09:09:25 UTC
This is by design.

The issue is that events and overrides are implemented using a subclass of UISearchBarDelegate, but they're implemented using different subclasses, so you can't get both at the same time.

I believe the easiest way to do what you want to do is to get MonoTouch.Dialog from github yourself and modify SearchDelegate in DialogViewController to override SelectedScopeButtonIndexChanged and then do what you want in there.