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

贡献者指南