How ro change Hamberger icon backgound color to green in .net maui

Thombre, Ashish 125 Reputation points
2024-06-27T20:16:02.1666667+00:00

When i am clicking on push notification it navigates to the Consumable request details page and when clicking on back button it navigates to the Consumable request page. When it navigates to Consumable Request page tools bar color changing to black automatically but i want tool bar and hamburger icon background color green.

Platform- Android

2024-06-27_16h07_34

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,212 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 38,911 Reputation points Microsoft Vendor
    2024-06-28T05:36:40.04+00:00

    Hello,

    After testing, when using Shell, you can use the following code to change the background color.

    Shell.BackgroundColor="Green"
    

    When using NavigationPage, you need to open the Resources/Styles/Styles.xaml file under the MAUI project and modify the default style of NavigationPage to change the background color.

    <Style TargetType="NavigationPage">
    <Setter Property="BarBackgroundColor" Value="{AppThemeBinding Light={StaticResource Green}, Dark={StaticResource Green}}" />
    <Setter Property="BarTextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource White}}" />
    <Setter Property="IconColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource White}}" />
    </Style>
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.