Note that there are some explanatory texts on larger screens.

plurals
  1. POXamlParseException when using Graph# libraries
    primarykey
    data
    text
    <p>I'm trying to use the <a href="http://graphsharp.codeplex.com/" rel="nofollow">Graph#</a> libraries in my <strong>VSPackage</strong> project, but unfortunately there are some obstacles to conquer. Here is what I did:</p> <p>I copied all the following DLL's to a folder /Libraries in the project root:</p> <ul> <li>GraphSharp.dll</li> <li>GraphSharp.Controls.dll</li> <li>QuickGraph.dll</li> <li>WPFExtensions.dll</li> </ul> <p>The Build Action of all is 'Content' and the option Copy to Output is set to 'Do not copy'.</p> <p>I added those references to my project. (Add Reference... -> Browse -> select them from the /Library folder)</p> <p>After that, I created the following files. You can see that the ViewModel is set to be the DataContext of the UserControl and that it defines a "MethodGraph" to which the UI binds.</p> <p><strong>XAML file</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;UserControl x:Class="Biocoder.InteractiveExploration.View.ExplorationControl" 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:graphsharp="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*"/&gt; &lt;RowDefinition Height="Auto"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;ListView Grid.Row="0" ItemsSource="{Binding SelectedMethods}"&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridViewColumn Header="Method" DisplayMemberBinding="{Binding Name}"/&gt; &lt;GridViewColumn Header="ReturnType" DisplayMemberBinding="{Binding ReflectionInfo.ReturnType}"/&gt; &lt;GridViewColumn Header="Incoming Calls"/&gt; &lt;GridViewColumn Header="Outgoing Calls"/&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; &lt;graphsharp:GraphLayout Graph="{Binding MethodGraph}"/&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p><strong>Code-behind</strong></p> <pre class="lang-c# prettyprint-override"><code>public partial class ExplorationControl : UserControl { public ExplorationControl() { InitializeComponent(); // set the datacontext DataContext = InteractiveExplorationPackage.ExplorationToolViewModel; } } </code></pre> <p><strong>ViewModel</strong></p> <pre class="lang-c# prettyprint-override"><code>public class ExplorationToolViewModel : ViewModelBase { private IBidirectionalGraph&lt;object, IEdge&lt;object&gt;&gt; _methodGraph; public IBidirectionalGraph&lt;object, IEdge&lt;object&gt;&gt; MethodGraph { get { return _methodGraph; } set { if (value != _methodGraph) { _methodGraph = value; NotifyPropertyChanged("MethodGraph"); } } } public ExplorationToolViewModel() { InitializeViewModel(); } private void InitializeViewModel() { SelectedMethods = new ObservableCollection&lt;Method&gt;(); CreateGraph(); } private void CreateGraph() { var g = new BidirectionalGraph&lt;object, IEdge&lt;object&gt;&gt;(); // add vertices string[] vertices = new string[5]; for (int i = 0; i &lt; 5; i++) { vertices[i] = i.ToString(); g.AddVertex(vertices[i]); } // add edges g.AddEdge(new Edge&lt;object&gt;(vertices[0], vertices[1])); g.AddEdge(new Edge&lt;object&gt;(vertices[1], vertices[2])); g.AddEdge(new Edge&lt;object&gt;(vertices[2], vertices[3])); g.AddEdge(new Edge&lt;object&gt;(vertices[3], vertices[1])); g.AddEdge(new Edge&lt;object&gt;(vertices[1], vertices[4])); MethodGraph = g; } } </code></pre> <p>Fortunately, I can compile the whole project but at runtime the following error in the XAML occurs on the tag (right above the needed tag):</p> <p><strong>Could not load file or assembly 'GraphSharp.Controls, PublicKeyToken=null' or one of its dependencies. The system cannot find the file.</strong></p> <p>But I referenced the assemblies, they are listed in the references list. What's the problem? Could it be that assemblies have to be referenced another way round than usual when writing a <strong>Visual Studio Package</strong> (plugin)?</p> <p><em>EDIT: I just tried to get it work in another project, so I just set up a normal WPF Application and did all the above. In this solution everything works properly! That's so strange!</em></p> <p>Hope you can help me :-) Best regards!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload