C# 缺少程序集-在WPF中使用OxyPlot
我在WPF中使用OxyPlot。尝试命名我的plotview时出现编译器错误: 编译器错误消息:CS0234:类型或命名空间名称 命名空间“NameOfProject”中不存在“Wpf”(是 您缺少程序集引用吗?) 我的XAML代码非常简单:C# 缺少程序集-在WPF中使用OxyPlot,c#,wpf,.net-assembly,oxyplot,C#,Wpf,.net Assembly,Oxyplot,我在WPF中使用OxyPlot。尝试命名我的plotview时出现编译器错误: 编译器错误消息:CS0234:类型或命名空间名称 命名空间“NameOfProject”中不存在“Wpf”(是 您缺少程序集引用吗?) 我的XAML代码非常简单: <Window x:Class="NameOfProject" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="ht
<Window x:Class="NameOfProject"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf"
Title="Plot_MV" Height="auto" Width="auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="35"/>
</Grid.RowDefinitions>
<Button
Grid.Row="0"
Margin="10,10,0,10"
Content="ExportToPDF"
Height="30"
Width="80"
HorizontalAlignment="Left" Click="Button_Click">
</Button>
<oxy:PlotView
x:Name="plotName"
Model="{Binding plotModel}"
Grid.Row="1">
</oxy:PlotView>
</Grid>
</Window>
我使用的是XS Express 2012和OxyPlot版本2015.1.1046.0
有人想办法修复它吗?假设您有自己的类:
MyWindow
:
namespace MyProject {
public class MyWindow : Window
{
// code here
}
}
然后在XAML
中,您的类需要被限定(使用名称空间)
我使用Oxyplut to,但我的xmlns是这个,试试这个:xmlns:oxy=”http://oxyplot.org/wpf“
我尝试过-如果在任何其他XMLN中不使用.Wpf,则相同的错误不能是相同的错误。可能您的问题出在项目的引用上,您是否正确地将oxyplot库添加到了项目中?您的x:Class
必须是合格的(使用名称空间)。是的,这是相同的错误-正确添加了库。我的Class使用名称空间
<Window x:Class="MyProject.MyWindow" ...