LeftBarButtonItem and RightBarButtonItem not shown in MonoTouch.Dialog DialogViewController

c#, monotouch.dialog, xamarin.ios

Solution

Navigation items are not usually updated through the navigation controller. Instead, they are updated via the NavigationItem property on the view controller:

this.NavigationItem.SetRightBarButtonItem(
        new UIBarButtonItem(UIImage.FromFile("some_image.png")
        , UIBarButtonItemStyle.Plain
        , (sender,args) => {
           // button was clicked
        })
    , true);

http://docs.xamarin.com/ios/recipes/Content_Controls/Navigation_Controller/Add_a_Nav_Bar_Right_Button

Problem

MonoTouch is 5.2.12. iOS is v5.1.1 (Simulator) Seems like I'm missing an important piece of a puzzle here. I'm subclassing `DialogViewController` and set it as the only controller in my UINavigationController. In `ViewWillAppear` of the subclassed `DialogViewController`, I'm trying to set the left and right bar button items: ``` this.NavigationController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, this.HandleDoneButtonTouched ); ``` Neither one of them is showing up. The title however is displayed. If I debug, I can see that the items are properly set. I have also tried to use `SetItems()` on the navigation controller: no effects either. The navigation controller is presented modally in a page sheet.

Original source