xamarin/Xamarin.Forms

[Bug] [Forms][iOS] Vector in ToolbarItem too big

Ouverte

#6 366 ouverte le 31 mai 2019

 (4 commentaires) (0 réaction) (0 personne assignée)C# (1 926 forks)batch import
e/3 :clock3:help wantedi/lowinactivep/iOS 🍎t/bug :bug:up-for-grabs

Métriques du dépôt

Stars
 (5 644 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Description

Hello everyone,

I'm trying to set an Icon for my Toolbar Item (for iOS). I did put the graphic (pdf) under the Vector field in my Assets.xcassets Universal field.

Then I place the Icon in (Forms) code like this:

ToolbarItem arrangeItem = new ToolbarItem
{
                    Icon = "Arrange.png",
                    Order = 0,
                    Command = (BindingContext as MainPageViewModel).ArrangeClickedCommand

 };
this.ToolbarItems.Add(arrangeItem);

Please note, I also tried with just Icon = "Arrange" as the name of the asset is Arrange. But I think as the compiler is creating the x1 x2 x3 anyway .png will work as well?

For some reason, the icon then appears in the center of the Toolbar

As you can see, the title is also "gone"

First I thought it might be just placed incorrectly but clicking anywhere in the Toolbar will cause the icon to trigger so I assume it just is super big or something. Additionally, if I remove the Icon and use a Text then everything is normal.

The vector file I use is this one: https://us.v-cdn.net/5019960/uploads/editor/d2/7bolrbhfzoog.pdf

Steps to Reproduce

  1. Create a Forms project and iOS project
  2. Place a Vector file in the xcassets folder in the Universal field
  3. Set this Vector as ToolbarItem Icon

Expected Behavior

The graphic appears in the correct size on the right side of the toolbar

Actual Behavior

The graphic appears in the center and react on touches anywhere in the toolbar.

Basic Information

  • Version with issue: Xamarin Forms 3.6.0.264807
  • Last known good version: /
  • IDE: Visual Studio Community for Mac 8.0.9 (Build 5)
    • iOS:
  • Affected Devices: iOS devices

Screenshots

Guide contributeur