如何将应用程序资源添加到应用程序的C#后端而不是XAML文件中?
在我的XAML文件中,我有以下内容:如何将应用程序资源添加到应用程序的C#后端而不是XAML文件中?,c#,xamarin,xamarin.forms,C#,Xamarin,Xamarin.forms,在我的XAML文件中,我有以下内容: <Application x:Class="App" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:converters="clr-namespace:M"> &
<Application
x:Class="App"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:M">
<Application.Resources>
<converters:InverseBool x:Key="InverseBool" />
<Color x:Key="IconAsphalt">#34495E</Color>
</Application.Resources>
</Application>
例如,我不知道如何为inverseebool
指定名称空间
希望有人能帮我做这件事。您只需使用
当然,您需要包括定义InverseBool
类的名称空间。您只需使用
当然,您需要包括定义
InverseBool
类的名称空间。名称空间不应该那么难,就像使用Yes在关键字之后的.cs文件顶部的名称空间一样,但是我如何添加它,因为有一个字符串作为第一个参数?名称空间不应该那么难,这与使用
Yes在.cs文件顶部紧跟关键字之后的名称空间相同,但由于第一个参数是字符串,如何添加该名称空间?
public App()
{
Resources.Add("InverseBool", "InverseBool");
Resources.Add("InverseBool", new InverseBool());