dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.85k stars 1.68k forks source link

The color of hamburger icon in FlyoutPage always be changed to the white in Maui. #23087

Open Jiang-Junjie opened 3 weeks ago

Jiang-Junjie commented 3 weeks ago

Description

My project is using FlyputPage as follows:

<FlyoutPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:local="clr-namespace:FlyoutPageNavigation"
            x:Class="FlyoutPageNavigation.MainPage">
    <FlyoutPage.Flyout>
        <local:FlyoutMenuPage x:Name="flyoutPage" />
    </FlyoutPage.Flyout>
    <FlyoutPage.Detail>
        <NavigationPage>
            <x:Arguments>
                <local:ContactsPage />
            </x:Arguments>
        </NavigationPage>
    </FlyoutPage.Detail>
</FlyoutPage>

You could see that I set a hamburger.png icon in FlyoutMenuPage:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:FlyoutPageNavigation"
             x:Class="FlyoutPageNavigation.FlyoutMenuPage"
             Padding="0,40,0,0"
             IconImageSource="hamburger.png"
             Title="Personal Organiser">
 //...

</ContentPage>

image

The origin color of hamburger icon is blue, however it always show white when program is running.

Screenshot 2024-07-03 at 08 51 51

Maybe it's a bug of Maui, we need to find a solution to solve this.

Note: We are using .net 7.0 with Visual Studio Community 2022 for Mac Version 17.6.12 (build 410), and running it in iOS 17.3 devices.

Thanks for taking care of this problem in advance.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.101

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 3 weeks ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Zhanglirong-Winnie commented 2 weeks ago

This issue has been verified using Visual Studio 17.6.12(build410)(.net7&.net8). Can be reproduced on iOS platform.

Thaldoras commented 2 weeks ago

NavigationPage has a BarTextColor property. This color is used to recolor the hamburger icon. You can set it to what you want. Additionally you can use the following method inside your pages to change the icon color NavigationPage.SetIconColor(this, AppColours.PrimaryDark);

Jiang-Junjie commented 1 week ago

NavigationPage has a BarTextColor property. This color is used to recolor the hamburger icon. You can set it to what you want. Additionally you can use the following method inside your pages to change the icon color NavigationPage.SetIconColor(this, AppColours.PrimaryDark);

Hi, whether you have a try this in FlyoutPage? it not works for me.

Thaldoras commented 1 week ago

Hi, whether you have a try this in FlyoutPage? it not works for me.

Inside "ContactsPage" you can use that method. Or on your NavigationPage you can set BarTextColor.

var navigationPage = new NavigationPage { BarTextColor = AppColours.PrimaryDark };

Sorry I don't use xaml so don't know how to show it in your code example.