Add a Nav Bar Right Button

PDF for offline use
Related SDKs:

Let us know how you feel about this

Translation Quality


This recipe shows how to add a right button to a navigation bar.


To add a button to the UINavigationBar using a built-in icon from the UIBarButtonSystemItem enumeration:

    new UIBarButtonItem(UIBarButtonSystemItem.Action, (sender,args) => {
       // button was clicked
, true);

To add a button to the UINavigationBar using a custom image:

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

Additional Information

To remove the button:

this.NavigationItem.SetRightBarButtonItem(null, true);

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.