Navigation DropDown dengan Xamarin Forms

Pada tutorial berikut ini saya akan membahas bagaimana cara menggunakan Navigation DropDown pada Xamarin Forms.

1. Tambahkan halaman xaml DropdownMenu.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage Title="Dropdown menggunakan Toolbar" xmlns=""
    <ToolbarItem Text="Home" Order="Secondary" Clicked="Navigate" CommandParameter="NavigationPage1" />
    <ToolbarItem Text="Second" Order="Secondary" Clicked="Navigate" CommandParameter="NavigationPage2" />

2. Tambahkan kode berikut pada file DropdownMenu.xaml.cs:

    public partial class DropdownMenu : ContentPage
        public DropdownMenu()

        protected async void Navigate(object sender, EventArgs args)

            string type = (string)((ToolbarItem)sender).CommandParameter;
            Type pageType = Type.GetType("Bab4." + type + ", Bab4");
            Page page = (Page)Activator.CreateInstance(pageType);
            await this.Navigation.PushAsync(page);

3. Jalankan program untuk melihat hasilnya. Tampilan menu dropdown yang dibuat dapat dilihat pada gambar berikut.


About Erick Kurniawan

IT Trainer, Consultant, & Microsoft Azure MVP Actual Training (
This entry was posted in Cross Platform Mobile Development, Xamarin Forms and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s