为什么在加载LiveCharts时会出现XamlParseException?

时间:2016-07-28 11:26:03

标签: c# wpf xaml mvvm livecharts

我使用MS VS 2015和.NET Framework 4.5.2编写C#WPF MVVM应用程序。我尝试使用LiveCharts。当LiveCharts加载时,会出现以下错误:PresentationFramework.dll中的XamlParseException。无法加载文件或程序集" LiveCharts.Wpf,PublicKeyToken = 3b585c2a5f1a92c1"或其中一个依赖项。下面我介绍XAML:

<UserControl x:Class="DeviceReading.Views.DeviceReadingView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:prism="http://prismlibrary.com/"
             xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             prism:ViewModelLocator.AutoWireViewModel="True">

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>

    <lvc:CartesianChart Grid.Row="0" Grid.Column="0">
        <lvc:CartesianChart.Series>
            <lvc:LineSeries Values="{Binding MyObservableColection}" PointGeometrySize="10" StrokeThickness="2"/>
        </lvc:CartesianChart.Series>
        <lvc:CartesianChart.AxisX>
            <lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" MaxValue="{Binding AxisMax}" MinValue="{Binding AxisMin}" DisableAnimations="True">
                <lvc:Axis.Separator>
                    <lvc:Separator Step="{Binding AxisStep}"/>
                </lvc:Axis.Separator>
            </lvc:Axis>
        </lvc:CartesianChart.AxisX>
    </lvc:CartesianChart>
</Grid>
</UserControl>

这里UserControl是Prism UserControl,MyObservableColection是

的实例
ObservableCollection<Tuple<DateTime, double>>

此集合包含我想在笛卡尔图表中显示的实时数据。我尝试从UserControl绑定的视图模型中删除所有代码,但上述错误仍在继续。在PrismModule的参考部分,其中带有LiveCharts的UserControl,我添加了以下参考:LiveCharts ver.0.7.10.0和LiveCharts.WPF ver.0.7.10.0。我今天开始使用LiveCharts,所以我是LiveCharts的绿色新秀。请帮忙。

0 个答案:

没有答案