Am new to oxyplot and wish to use it with C# WPF with xaml. My .xaml file has the following code:
<code>
<Window x:Class="CurveMaster.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CurveMaster"
xmlns:oxy="http://oxyplot.org/wpf"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
<local:MainViewModel/>
</Window.DataContext>
<Grid>
<oxy:Plot Title="{Binding Title}">
<oxy:Plot.Series>
<oxy:LineSeries ItemsSource="{Binding Points}"/>
</oxy:Plot.Series>
</oxy:Plot>
</Grid>
</Window>
</code>
The .xaml.cs file is as follows:
<code>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using OxyPlot;
namespace CurveMaster
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public class MainViewModel
{
public MainViewModel() //Constructor
{
this.Title = "My Graph";
this.Points = new List<DataPoint>
{
new DataPoint (0,4),
new DataPoint (10,13),
new DataPoint (20,15),
};
}
public string Title { get; private set; }
public IList <DataPoint> Points { get; private set; }
}
}
</code>
So I'm just trying to run the above simple example but get the following error messages in the xaml file:
- The type 'oxy:Plot' was not found. Verify that you are not missing an assembly reference.
- The name "MainViewModel" does not exist in the namespace "clr-namespace:CurveMaster".
Now I installed the oxyplot Nuget package for WPF and installation was successful. However, above tells me that the above two issues are both referencing issues but I cannot figure out what the problem is. What additional oxyplot referencing is required once the package is installed?
Secondly why does it give me the MainViewModel does not exist message when in fact it does exist in the CurveMaster namespace?
Thanks in advance.