CarouselView Xamarin 插件不工作
CarouselView Xamarin Plugin not working
我收到以下错误:
Error CS0234: The type or namespace name 'CarouselView' does not exist
in the namespace 'Xamarin.Forms' (are you missing an assembly reference?)
(CS0234) (your project)
在 XAML
上使用它
xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
包的名称是:CarouselView.FormsPlugin
。
更新......
xaml
根据 project documentation on GitHub,启用插件需要执行几个步骤:
通过 NuGet 安装包
初始化插件
在通用 Windows 平台上包含 Xamarin.Forms 初始化:
List<Assembly> assembliesToInclude = new List<Assembly>();
assembliesToInclude.Add(typeof(CarouselViewRenderer).GetTypeInfo().Assembly);
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
在 iOS 和 Android 上 Xamarin.Forms 初始化之后:
Xamarin.Forms.Init();
CarouselViewRenderer.Init();
在XAML
中使用
对于 XAML 用法,您需要包含与问题中所述不同的名称空间 (CarouselView.FormsPlugin.Abstractions
):
xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
现在用作:
<controls:CarouselViewControl ...>
我收到以下错误:
Error CS0234: The type or namespace name 'CarouselView' does not exist
in the namespace 'Xamarin.Forms' (are you missing an assembly reference?)
(CS0234) (your project)
在 XAML
上使用它 xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
包的名称是:CarouselView.FormsPlugin
。
更新......
xaml
根据 project documentation on GitHub,启用插件需要执行几个步骤:
通过 NuGet 安装包
初始化插件
在通用 Windows 平台上包含 Xamarin.Forms 初始化:
List<Assembly> assembliesToInclude = new List<Assembly>();
assembliesToInclude.Add(typeof(CarouselViewRenderer).GetTypeInfo().Assembly);
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
在 iOS 和 Android 上 Xamarin.Forms 初始化之后:
Xamarin.Forms.Init();
CarouselViewRenderer.Init();
在XAML
中使用对于 XAML 用法,您需要包含与问题中所述不同的名称空间 (CarouselView.FormsPlugin.Abstractions
):
xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
现在用作:
<controls:CarouselViewControl ...>