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
22.21k stars 1.75k forks source link

Android ToolbarItem shows incorrect icon on Navigation subpage #11829

Open edgiardina opened 1 year ago

edgiardina commented 1 year ago

Description

If you have a toolbar item without an icon specified on a navigation subpage, instead of showing the text property, it will use the toolbar item's icon source from the previous page.

Steps to Reproduce

  1. Create a File -> New .NET MAUI
  2. Create a Main Page with a Toolbar Item. This toolbar item should have an IconImageSource defined
  3. Create a sub Page with a toolbar item. This toolbar item should NOT have an IconImageSource defined
  4. Navigate from MainPage to Subpage
  5. Subpage will show ToolbarItem with the wrong IconImageSource
  6. Expected result is IconImageSource not present yields a text display of the Toolbar Item

Link to public reproduction project repository

https://github.com/edgiardina/MauiBug_ToolbarItem_NoIconBehavior

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 13 API 33

Did you find any workaround?

No response

Relevant log output

No response

brabebhin commented 1 year ago

A thing to note is that subsequent navigations do work correctly for a while, then stop working again. The bug has 100% repro rate only on the first navigation, then it becomes random. Probably has something to do with how pages are cached in navigation.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

RobTF commented 1 year ago

Yep confirmed I just hit this too. I tired explicitly setting the IconImageSource to {x:Null} to no effect.

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.7.0 Preview 1.0. Repro on Android 13.0-API33 with the provided Project: MauiBug_ToolbarItem_NoIconBehavior.zip

image

ThysBrits commented 3 months ago

We have the same issue still on 8.0.100. On a ContentPage with multiple ToolbarItems, if one doesn't have an icon it will use the icon of one of the other ToolbarItems, or if you navigate to another page with ToolbarItems and then navigate back, it will use the icon from that page. A fix was supposedly done in https://github.com/dotnet/maui/issues/7823, but it doesn't seem to have resolved this. Also see #10659