Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Latest commit

 

History

History

add_a_nav_bar_right_button

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
id title brief sdk
79698AE6-8B70-7189-D52D-2D1801EEB833
Add a Nav Bar Right Button
This recipe shows how to add a right button to a navigation bar.

Recipe

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

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

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

this.NavigationItem.SetRightBarButtonItem(
    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);