xamarin/Xamarin.Forms

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

開放

#6,366 建立於 2019年5月31日

 (4 則留言) (0 個反應) (0 位負責人)C# (1,926 個分叉)batch import
e/3 :clock3:help wantedi/lowinactivep/iOS 🍎t/bug :bug:up-for-grabs

倉庫指標

星標
 (5,644 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

貢獻者指南