OxyPlot.Xamarin.Forms包会破坏Resource.Designer.cs文件吗?

3
我正在尝试在共享的Xamarin.Forms项目中使用OxyPlot.Xamarin.Forms包。我按照描述在可移植和平台特定(Android)项目中使用NuGet软件包管理器添加了OxyPlot软件包,如下所示:http://docs.oxyplot.org/en/latest/getting-started/hello-xamarin-forms.html。然后,我在Android项目中初始化了OxyPlot渲染器。现在,当我尝试启动应用程序时,Resource.Designer.cs文件被生成,但我收到了数百个错误,例如:
Error   CS0117  'Resource.Attribute' does not contain a definition for 'mediaRouteSettingsDrawable' OxyPlotShared.Droid \OxyPlotShared\OxyPlotShared.Droid\Resources\Resource.Designer.cs

我使用Xamarin.Forms v2.2.0.31和所有OxyPlot包的版本为1.0.0-unstable1983。
我有什么遗漏吗?
1个回答

1
请注意,有两种不同的项目模板:PortableShared。在您的帖子中提到了它们两个,所以请明确您正在使用哪一个。您正在遵循的具体示例是针对Portable项目模板的。在添加OxyPlot Nuget Package后,我必须手动将OxyPlotOxyPlot.Xamarin.Forms添加到PortableReferences中。之后,它就可以正常工作了。我正在使用Xamarin.Forms 2.0.0.6482和OxyPlot 1.0.0-unstable1983。
我使用以下代码添加了PlotView

App.cs:

 public App()
    {
        PlotModel plotModel = new PlotModel { PlotAreaBackground = OxyColors.LightYellow };
        plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)"));

        // The root page of your application
        MainPage = new ContentPage {
            Content = new PlotView {
                VerticalOptions = LayoutOptions.Fill,
                HorizontalOptions = LayoutOptions.Fill,
                Model = plotModel
            }
        };
    }

enter image description here


1
它可以与Xamarin.Forms 2.0.0.x甚至2.1.0.x一起使用,但无法与Xamarin 2.2.0.31一起使用。为了与AppCompact 23.3.0兼容,需要修复Oxyplot.Xamarin.Android库。 - danoliv
是的,OxyPlot.Xamarin.Forms.1.0.0-unstable1983(Android)正在“打破”我的精神,让我回到了1883年。 - Ahmed Alejo

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接