0

How can I navigate back with events (let say Tapped for String element)? Programmatically

Section s =  someelement.Parent as Section;
RootElement re =  s.Parent as RootElement;
// how to get to DialogViewControler or something to navigate back?

Thanks

mel

moljac
  • 946
  • 9
  • 12

2 Answers2

0

Pretty new here but don't you want to use the NavigationController to do that? I guess you're inside a DialogViewController where your event's implemented? So you could just do :

this.NavigationController.PopViewControllerAnimated(true);
biegleux
  • 13,179
  • 11
  • 45
  • 52
baramuse
  • 360
  • 2
  • 10
0

Baramuse's answer will work IF your DVC is within a NavController. But MTD works in both a nav controller style and modal dialog style. Your better off letting MTD do that work for you (so if anything changes in the future your code will still work). The DialogViewController provides just the method:

    /// <summary>
    /// Dismisses the view controller.   It either pops or dismisses
    /// based on the kind of container we are hosted in.
    /// </summary>
    public void DeactivateController (bool animated)
    {
        var parent = ParentViewController;
        var nav = parent as UINavigationController;

        if (nav != null)
            nav.PopViewControllerAnimated (animated);
        else
            DismissModalViewControllerAnimated (animated);
    }
Tyson
  • 14,726
  • 6
  • 31
  • 43