1
votes

I am new to MonoTouch and thus MonoTouch.Dialog. Using the Elements API, I've created a simple view with two buttons, "Accounts" and "Contacts".

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
    _window = new UIWindow(UIScreen.MainScreen.Bounds);

    _rootElement = new RootElement("Sample")
    { 
        new Section()
        {
            new StringElement ("Accounts", delegate { ElementTapped(); }),
        },
        new Section()
        {
            new StringElement ("Contacts", delegate { ElementTapped(); }),
        }
    };

    _rootVC = new DialogViewController(_rootElement);
    _nav = new UINavigationController(_rootVC);
    _window.RootViewController = _nav;

    _window.MakeKeyAndVisible ();

    return true;
}

Once I tap on either button, I want to bring up a new view to search with. I know I have to create a new DialogViewController with EnableSearch set to true, but how do I then add this to my NavigationController from within the delegate?

Thank you.

1

1 Answers

1
votes

For "Accounts" and "Contacts" use a new "RootElement" that you have configured to create your nested DialogViewController on demand:

 new RootElement ("Accounts", x => {
     return new DialogViewController (....) {
          EnableSearch = true
     }
 }