问题描述
我是 oxyplot 的新手,并希望将它与带有 xaml 的 C# WPF 一起使用。我的 .xaml 文件具有以下代码:
<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>
.xaml.cs 文件如下:
<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>
所以我只是尝试运行上面的简单示例,但在 xaml 文件中收到以下错误消息:
现在我为WPF安装了oxyplot Nuget包并且安装成功。但是,上面告诉我上述两个问题都是参考问题,但我无法弄清楚问题是什么。安装包后需要哪些额外的 oxyplot 引用?
第二,为什么它给我 Mainviewmodel 不存在的消息,而实际上它确实存在于 CurveMaster 命名空间中?
提前致谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)