0

I have a Dialog that is a full screen Modal popup.

It has a Group of radioelements. When selected a new screen of, in this case, states appears.

When a state is selected, how can I get the screen to "pop" back to the main dialog when there is no UINavigation Controller?

var rWhoToSee = new RootElement ("What State are you in??", gWhoToSee) {
    new Section (){
           new RadioElement ("ACT"),
           new RadioElement ("NT"), 
           new RadioElement ("NSW"),
           new RadioElement ("TAS")
            }
    };
Ian Vink
  • 66,960
  • 104
  • 341
  • 555

3 Answers3

2

Any child Dialog has a PresentingViewController property. That can be used to dismiss, or used to communicate to the control that caused the Dialog to appear.

    var vc = dlg.PresentingViewController as MyViewController;
    dlg.DismissViewController (true, () => {});
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
0

You need to ask the parent controller to dismiss the modal using DismissModalViewController()

Jason
  • 86,222
  • 15
  • 131
  • 146
  • But how can you get the parent View Controller from a RootElement? – Ian Vink Apr 19 '12 at 19:04
  • good point - can an element access it's own DVC? If so, pass a reference to your parent into your modal DVC. If not, you might have to do some customization of MT.D. – Jason Apr 19 '12 at 19:07
0

Call the "pop" method of your choice from your navigation controller like below:

NagivationController.PopViewControllerAnimated(true);

You could also just group all of your elements:

new RootElement ("Clients", new RadioGroup("clientGroup", 0)) {
    new Section () {
        new RadioElement ("Happy client", "clientGroup"),
        new RadioElement ("Angry client", "clientGroup")
    }
};

Using the grouping will currently allow for it to auto pop back to the previous screen where the root element will display "Clients" in the caption and then whatever the first option in your group is. So, in this case it would show "Happy client".

BRogers
  • 3,534
  • 4
  • 23
  • 32