Universal Windows Platform (UWP)


This section is under construction. Please contribute!

This example shows how to create apps for Windows Universal.

Create project

Start Visual Studio and select “FILE -> New -> Project…”. Select “Windows -> Universal -> Blank App (Universal Windows)” to create new projects for Windows and Windows Phone:


Add references

You need references to the OxyPlot and OxyPlot.Windows assemblies. The easiest way to do this is to right click on the “References” item in the Solution Explorer and select “Manage NuGet Packages…” (this requires that the “NuGet Package Manager” extension is installed).

In the “Manage NuGet packages” dialog, search for “oxyplot.windows” in the top-right search textbox. Select the “OxyPlot.Windows” package and click install:


You can also use the Package Manager Console to install the package:

PM> Install-Package OxyPlot.Windows

Create a view model

Add a class that creates a PlotModel and a FunctionSeries.

namespace UniversalApp1
    using System;

    using OxyPlot;
    using OxyPlot.Series;

    public class MainViewModel
        public MainViewModel()
            this.MyModel = new PlotModel { Title = "Example 1" };
            this.MyModel.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)"));

        public PlotModel MyModel { get; private set; }

Create the view

Define the namespace in the Page element, set the DataContext and add a PlotView control:


    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <oxy:PlotView Model="{Binding MyModel}"/>

The application should now look like this:


The source code can be found in the HelloWorld\UniversalApp1 folder in the documentation-examples repository.