问题描述
我从项目中的图像文件生成了一些常量。但是,我无法将多个静态类作为 Xaml 属性访问。
Cannot resolve type "Constants.Images.Icons.IcAccount.Svg". (XFC0000)
namespace Common
{
public static class Constants
{
public static class Images
{
public static class Icons
{
public static class IcAccount
{
public static readonly string Svg = "res:images.icons.ic_account";
public static readonly string File = "ic_account.svg";
}
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage
x:Class="myapp.Pages.ActiveBookingPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:control="clr-namespace:myapp.Controls;assembly=myapp"
xmlns:common="clr-namespace:myapp.Common;assembly=myapp">
<ContentPage.Content>
<control:CustomImageButton
ButtonImage="{x:Static common:Constants.Images.Icons.IcAccount.Svg}"
我已经尝试了几种变体,但是我只能指定 {x:Static common:Constants.Svg}
我很乐意更改常量类的格式。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)