Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Fix UWP Toolbar icons #8147

Merged
merged 4 commits into from
Nov 4, 2019
Merged

Fix UWP Toolbar icons #8147

merged 4 commits into from
Nov 4, 2019

Conversation

jfversluis
Copy link
Member

@jfversluis jfversluis commented Oct 22, 2019

Description of Change

Change the icons on UWP ToolbarItem to map to AppBarButton.Content and add an Image in there instead of using the AppBarButton.Icon directly because of a bug in UWP.

Issues Resolved

API Changes

None

Platforms Affected

  • UWP

Behavioral/Visual Changes

The toolbar icons will look a bit different and less "iconized". You can now show full colored icons.

If users are not doing so already, they can create monochromatic images to mimic the old behavior themselves.

Before/After Screenshots

As you can see in the screenshots below there is a slight difference in the look whenever the toolbar item is primary. This change also allows full color icons to be used.

You can also see a black square, that is the full color Xamarin logo. In the old way, this was not supported, in the new way it is. You can see while using the new way for a secondary item the full colored Xamarin logo is (still) a black square. To make an icon still show up when a toolbar item is secondary, we still need to assign it directly to AppBarButton.Icon. I have tested if the bug with the secondary monitor also affects items that are secondary, but from what I can tell it does not.

Original icons used in both screenshots below

bank
calculator

Old

Old way of showing icons

New

New way of showing icons

Testing Procedure

Go to Issue7505 and inspect the toolbar icons. It will take a dual monitor setup (with different resolutions) to test if the icons are not disappearing anymore. To see the old vs new appearance you would have to comment some lines in the Platform.cs file. Or you can compare the looks from the secondary item icons and the primary ones.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

Copy link
Contributor

@hartez hartez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to deal with the TODO

@samhouts samhouts requested a review from hartez October 23, 2019 23:59
@jfversluis
Copy link
Member Author

I think if we really want to (in a later stage) there are some APIs available within UWP to make an image monochromatic. Which comes of course at a performance cost. I've looked into making this possible with this change immediately, but using those APIs seemed to take another good but of effort which I'm not sure is worth it at this point.

The other way around is also true: I discovered that there is a property on the icons (that are used now) which lets you make them non-monochromatic. Maybe something we could expose as a platform specific or something.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Has two approvals, no pending reviews, and no changes requested breaking Changes behavior or appearance p/UWP partner/cat 😻 t/bug 🐛
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants