3

I'm trying to use the OxyPlot.Xamarin.Forms package in my shared Xamarin.Forms project. I added the OxyPlot packages with the NuGet package manager in both the portable and the platform specific (Android) projects like descriped at:

http://docs.oxyplot.org/en/latest/getting-started/hello-xamarin-forms.html

Then I initialized the OxyPlot renderers in the Android project. Now, when I try to start the App the Resource.Designer.cs file is generated, but I get hundreds of errors like so:

Error   CS0117  'Resource.Attribute' does not contain a definition for 'mediaRouteSettingsDrawable' OxyPlotShared.Droid \OxyPlotShared\OxyPlotShared.Droid\Resources\Resource.Designer.cs

I use Xamarin.Forms v2.2.0.31 and all OxyPlot packages in version 1.0.0-unstable1983.

Am I missing something?

0

1 Answer 1

1

Note that there are 2 different project templates: Portable and Shared. In your post you mention both of them, so be clear about which one you're using. The specific example you're following is for a Portable project template. After adding the OxyPlot Nuget Package, I had to manually add OxyPlot and OxyPlot.Xamarin.Forms to the References of the Portable one. After that, it worked just fine. I'm using Xamarin.Forms 2.0.0.6482 and OxyPlot 1.0.0-unstable1983.

I added the PlotView using code:

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

Sign up to request clarification or add additional context in comments.

2 Comments

It works with Xamarin.Forms 2.0.0.x and even with 2.1.0.x but it does not work with Xamarin 2.2.0.31. Oxyplot.Xamarin.Android library needs to be fixed in order to be compatible to AppCompact 23.3.0
Yeah OxyPlot.Xamarin.Forms.1.0.0-unstable1983 (Android) is "Breaking Bad" my spirit rolling back to 1883

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.