EluciusFTW EluciusFTW - 1 month ago 17
C# Question

OxyPlot in Xaml

I have downloaded the binaries of OxyPlot, but can't get it to work in my .Net 4.0 WPF application. I have added references to 'OxyPlot.dll' and 'OxyPlot.WPF.dll', and my code-behind recognizes it fine (I can, e.g., create an instance of

PlotModel
) but in my XAML view I have not been able to add the reference correctly. Following examples I have tried

<UserControl ...
xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf">


with all combinations of 'OxyPlot' and 'OxyPlot.Wpf' but I always get the error message:

Error 1 Unable to load the metadata for assembly 'OxyPlot.Wpf'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'OxyPlot.Wpf, Version=2014.1.1.1, Culture=neutral, PublicKeyToken=75e952ba404cdbb0' or one of its dependencies. Das System kann die angegebene Datei nicht finden.

I am using VS 2010 Express (i.e., I cannot install the package via Nuget :-( ...)

Answer

The answer turned out to be simple: The instructions in the link http://go.microsoft.com/fwlink/?LinkId=179545 given in the error message really worked. One has to tell VS that these files are 'trusted', so

  • close VS
  • right-click on the .dll's and select 'properties'
  • in the 'general' Tab, press the 'unblock' button

What is really weird and kind of hilarious to me is that VS will let me work with these 'untrusted .dlls' just fine in c# code, but not in .xaml ...

Comments