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

Fix to display toolbar icons under UWP Shell (partial fix for #11706). #11838

Merged
merged 2 commits into from
Nov 3, 2020

Conversation

JogyBlack
Copy link
Contributor

Description of Change

The ShellToolbarItemTemplate for UWP was using incorrect binding for the IconImageSource, resulting in
Error: Converter failed to convert value of type 'Xamarin.Forms.Internals.AsyncValue1<Windows.UI.Xaml.Media.ImageSource>' to type 'ImageSource'; BindingExpression: Path='IconImageSource' DataItem='Xamarin.Forms.ToolbarItem'; target element is 'Windows.UI.Xaml.Controls.Image' (Name='null'); target property is 'Source' (type 'ImageSource').
`
Also, after correcting the binding error, the icon was displayed above the text and was very small, so I moved it to the left of the text.

Issues Resolved

API Changes

None

Platforms Affected

  • UWP

Behavioral/Visual Changes

Toolbar items under UWP Shell can now display both icon and text.

Before/After Screenshots

11706-before

11706-after

Testing Procedure

  1. Create a default Xamarin.Forms app using Shell.
  2. Add UWP project
  3. Add toolbar items to the main page:
    <ContentPage.ToolbarItems> <ToolbarItem Text="Add" Clicked="AddItem_Clicked" IconImageSource="tab_feed.png"/> <ToolbarItem Text="Secondary" Order="Secondary" IconImageSource="tab_about.png"/> </ContentPage.ToolbarItems>
    When the UWP app is started, the toolbar should display both image and text.

PR Checklist

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

@dnfadmin
Copy link

dnfadmin commented Aug 19, 2020

CLA assistant check
All CLA requirements met.

@samhouts samhouts added the retarget-branch-required PR or associated issues target a milestone. Please target this PR to the matching branch. label Aug 19, 2020
@samhouts samhouts changed the base branch from main to 5.0.0 August 31, 2020 23:20
@samhouts samhouts added retarget-branch-required PR or associated issues target a milestone. Please target this PR to the matching branch. and removed retarget-branch-required PR or associated issues target a milestone. Please target this PR to the matching branch. labels Aug 31, 2020
@PureWeen
Copy link
Contributor

PureWeen commented Nov 2, 2020

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@PureWeen PureWeen removed the retarget-branch-required PR or associated issues target a milestone. Please target this PR to the matching branch. label Nov 2, 2020
@PureWeen PureWeen merged commit f57f90d into xamarin:5.0.0 Nov 3, 2020
@samhouts samhouts added this to the 5.0.0 milestone Nov 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] UWP Shell - Toolbar buttons do not work correctly
5 participants