Articles in this section
Category / Section

How to Show Hamburger Icon in .NET MAUI Navigation Drawer Pages?

6 mins read

This article explains how to display a hamburger icon on all pages in the .NET MAUI Navigation Drawer.

Step 1: Add a hamburger icon in the header
To display the hamburger icon on every page and toggle the Navigation Drawer, follow these steps:

  1. Using a Grid layout, place the hamburger icon in the header section.
  2. Define the Navigation Drawer in the main content area, and configure key properties such as: DrawerHeaderView, DrawerContentView and DrawerHeaderHeight.
 <Grid RowDefinitions="80,*">
    <Grid BackgroundColor="#6750A4" ColumnDefinitions="Auto,*,Auto" Grid.Row="0" ColumnSpacing="10" Padding="10,0">
        <Image Grid.Column="0"
             HeightRequest="30"
             WidthRequest="30"
             HorizontalOptions="Start"
             Source="hamburgericon.png"             
             BackgroundColor="#6750A4">
            <Image.GestureRecognizers>
                <TapGestureRecognizer Tapped="Handle_Clicked"/>
            </Image.GestureRecognizers>
        </Image>
    </Grid>

    <navigationdrawer:SfNavigationDrawer x:Name="navigationDrawer" Grid.Row="1">
        <navigationdrawer:SfNavigationDrawer.DrawerSettings>
            <navigationdrawer:DrawerSettings DrawerHeaderHeight="177" DrawerWidth="260" DrawerHeight="{OnPlatform WinUI=400}" ContentBackground="#F7F2FB" DrawerFooterHeight="0">
                <navigationdrawer:DrawerSettings.DrawerHeaderView>
                    <Grid RowDefinitions="*,Auto,Auto" Padding="25,25,25,20">
                        <Image Source="user.png" VerticalOptions="Center" WidthRequest="72" HeightRequest="72"/>
                        <Label Grid.Row="1" Text="Leslie Alexander"  VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="#1C1B1F" FontAttributes="Bold" FontSize="16" WidthRequest="154"  HorizontalOptions="Center"/>
                        <Label Grid.Row="2" Text="UX Designer"  VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="#1C1B1F" FontSize="12" WidthRequest="148" HeightRequest="24" HorizontalOptions="Center"/>
                    </Grid>
                </navigationdrawer:DrawerSettings.DrawerHeaderView>

                <navigationdrawer:DrawerSettings.DrawerContentView>
                    <ListView x:Name="listView"
                  ItemSelected="On_ItemSelected">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <Grid>
                                        <Label Text="{Binding}"          
                                               FontSize="16"
                                               Margin="10,7,0,0"
                                               TextColor="Black"
                                               HorizontalOptions="Start"
                                               VerticalOptions="Center">
                                        </Label>
                                    </Grid>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </navigationdrawer:DrawerSettings.DrawerContentView>
            </navigationdrawer:DrawerSettings>
        </navigationdrawer:SfNavigationDrawer.DrawerSettings>
    </navigationdrawer:SfNavigationDrawer>
</Grid>

Step 2: Navigating between pages
In the DrawerContentView, you can add a list of items to allow navigation between different pages. When an item is selected, you can navigate to the corresponding page and update the content of the drawer.

  private void On_ItemSelected(object sender, SelectedItemChangedEventArgs e) 
 {
     if (e.SelectedItem.ToString() == "Home")
         navigationDrawer.ContentView = new HomePage().Content;
     else if (e.SelectedItem.ToString() == "Profile")
         navigationDrawer.ContentView = new ProfilePage().Content;
     navigationDrawer.ToggleDrawer();
 }
 
 void Handle_Clicked(object sender, System.EventArgs e) 
 {
    navigationDrawer.ToggleDrawer();
 }

Step 3: Create a new page
Create the new page that you want to navigate to.

<ContentPage>
<VerticalStackLayout>
    <Label Text="Welcome to Home Page!"
           VerticalOptions="Center"
           HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>

Output

CPH26612025-04-2410-08-52online-video-cutter.com-ezgif.com-video-to-gif-converter.gif

Download the complete sample from GitHub

Conclusion

I hope you enjoyed learning how to show hamburger icon in .NET MAUI Navigation Drawer pages.

You can refer to our .NET MAUI NavigationDrawer feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our .NET MAUI NavigationDrawer example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our Support Forums, Direct-Trac, or Feedback Portal. We are always happy to assist you

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied