gpt4 book ai didi

xamarin - 图像在 xamarin.forms 中没有绑定(bind)?

转载 作者:行者123 更新时间:2023-12-02 04:25:10 25 4
gpt4 key购买 nike

我在 xamarin.forms 中工作。本地镜像不具有约束力。图片文件夹enter image description here

检索图像的代码是

    public const string RESOURCE_CIRCLE = "RadioCheckNoPlugin.Controls.Resources.circle.png";
public const string RESOURCE_DOT = "RadioCheckNoPlugin.Controls.Resources.dot.png";

public IconView iconCircle = new IconView { Source = ImageSource.FromResource(RESOURCE_CIRCLE), FillColor = GlobalSetting.BorderColor, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center, HeightRequest = GlobalSetting.Size, WidthRequest = GlobalSetting.Size };
public IconView iconChecked = new IconView { Source = ImageSource.FromResource(RESOURCE_DOT), FillColor = GlobalSetting.Color, IsVisible = false, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center, HeightRequest = GlobalSetting.Size, WidthRequest = GlobalSetting.Size };

图像属性 Build Action:Embedded resource 并且我没有收到任何错误。我也尝试删除 .png 扩展名,但它不具有约束力。请帮助我如何绑定(bind)图像。

最佳答案

如下更改图像路径常量:

public const string RESOURCE_CIRCLE = "resource://RadioCheckNoPlugin.Controls.Resources.circle.png";
public const string RESOURCE_DOT = "resource://RadioCheckNoPlugin.Controls.Resources.dot.png";

关于xamarin - 图像在 xamarin.forms 中没有绑定(bind)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55215462/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com