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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.AsyncValue
1<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
Behavioral/Visual Changes
Toolbar items under UWP Shell can now display both icon and text.
Before/After Screenshots
Testing Procedure
<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