[Solved] UserControl: XamlParseException

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

Nikzeno wrote at 2014-06-18 12:51:

Hi everybody,

I'm a newbie to OxyPlot and WPF. I was able to run this example and adding some more fun stuff in a stand-alone application.
But when I try to make a User Control Library I keep getting a XamlParseException: impossible to load OxyPlot.Wpf, PublicKeyToken=75e952ba404cdbb0

In the main program I simply have an empty window with my control. The xaml in VS renders fine!

I'm using VS 2013 Update 2, Win 7, .net 4 or 4.5 behaves the same.
Oxyplot is 2014.1.318.1

It's probably a stupid trivial error, but I need somebody to point me to the right direction!
Thanks!
<UserControl x:Class="WpfControlLibrary1.UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:oxy="http://oxyplot.codeplex.com"
             xmlns:local="clr-namespace:WpfControlLibrary1"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.DataContext>
        <local:MainViewModel/>
    </UserControl.DataContext>
    <Grid>
        <oxy:PlotView Title="{Binding Title}">
            <oxy:PlotView.Series>
                <oxy:LineSeries ItemsSource="{Binding Points}"/>
            </oxy:PlotView.Series>
        </oxy:PlotView>
    </Grid>
</UserControl>
namespace WpfControlLibrary1
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
    }

    public class MainViewModel
    {
        public MainViewModel()
        {
            this.Title = "Example 2";
            this.Points = new List<DataPoint>
                              {
                                  new DataPoint(0, 4),
                                  new DataPoint(10, 13),
                                  new DataPoint(20, 15),
                                  new DataPoint(30, 16),
                                  new DataPoint(40, 12),
                                  new DataPoint(50, 12)
                              };
        }

        public string Title { get; private set; }

        public IList<DataPoint> Points { get; private set; }
    }
}

Nikzeno wrote at 2014-07-02 11:15:

Yep, this was very trivial.
For some reason VS was not copying OxyPlot.wpf.dll in the necessary path... I had to do it manually.
Oddly enough this happened also on another PC with Windows 8.1...

objo wrote at 2014-07-02 12:43:

Did you use the OxyPlot.Wpf NuGet package? Maybe there is something that should be fixed..

Nikzeno wrote at 2014-07-02 14:18:

Yes, I installed it from the NuGet Package Manager (not the console).