I'm trying to get a basic graph to show in VS 2012. I've read the help files, but they assume a layout with a NodeXLControl, which is where the XAML comes into play (and things get all messed up).
The steps I've taken are outlined below:
- Create a new WPF Application in VS 2012
- Add Smrf.NodeXL.Control.Wpf, Smrf.NodeXL.Core and Smrf.NodeXL.Visualization.Wpf via Project -> Add Reference
- Switch to the XAML editor, open the toolbox, right-click and select "Choose Items..."
- In the popup, click browse and navigate to Smrf.NodeXL.Control.Wpf.dll, make sure the NodeXLControl is selected and press OK.
- From the Toolbox, drag the NodeXLControl to the MainWindow (or simply double-click the NodeXLControl).
- Get an error saying
A reference to "Smrf.NodeXL.Control.Wpf, version=18.104.22.168, culture=neutral, PublicKeyToken=7d233ba7875a1b76" has been added to the project. In order to use types from the new reference, press OK to restart XAML Designer. After XAML designer restarts,
re-create the control on the artboard.
- Read the error, press OK.
- Go to step 5
I've read some other topics
and have seen the C# (in my case) code of NodeXLControl in the help file (which assumes the existence of a NodeXLControl control in the XAML).
I've also tried adding the NodeXLControl in the XAML like (this
) (also tried replacing Microsoft with Smrf) and VS said
The name "NodeXLControl" does not exist in the namespace "clr-namespace:Smrf.NodeXL.Visualization.Wpf;assembly=Smrf.NodeXL.Control.Wpf":
Title="Window1" Height="300" Width="300" Loaded="Window_Loaded">
<ListBox Margin="39,38,61,57" Name="listBox1">
<Button Height="23" HorizontalAlignment="Left" Margin="42,12,0,0" Name="button1" VerticalAlignment="Top" Width="75">Button</Button>
Needless to say I'm relatively new to VS altogether so it would be great if someone would be able to help me kickstart my project.
Thanks in advance!
I don't have Visual Studio 2012, so I can't do exactly what you're doing. I just tried it in Visual Studio 2010 and it worked fine, but I know that doesn't help you much.
One problem is that the control has changed since I wrote the posts I think you were reading. You have to add the following
assembly references, not just the three from the earlier posts:
Try the following. These instructions are for 2010, but I hope they work similarly in 2012 as well.
- Reset your Toolbox, which in 2010 you can do by right-clicking a category header in the Toolbox and selecting Reset Toolbox.
- Start a new WPF project.
- Add the five references listed above.
- Right-click a category header in the Toolbox, select Choose Items, click the Browse button in the WPF Components tab, and select the Smrf.NodeXL.Control.Wpf.dll file. That adds NodeXLControl to the Toolbox.
- Drag a NodeXLControl from the Toolbox to your window.
If that doesn't work, try skipping the designer and directly edit the XAML again. Here is the XAML that the Visual Studio 2010 designer created for me:
Title="MainWindow" Height="350" Width="525" xmlns:my="clr-namespace:Smrf.NodeXL.Visualization.Wpf;assembly=Smrf.NodeXL.Control.Wpf">
<my:NodeXLControl HorizontalAlignment="Left" Margin="219,68,0,0" Name="nodeXLControl1" VerticalAlignment="Top" />
By the way, we have plans to upgrade the entire NodeXL project to Visual Studio 2012. It's currently built with 2008. We are way behind the times.
I'm working with Bastiaan on the project, and we fixed the problem. It was quite an easy fix. The problem was that Windows (7) 'locked' the files, because they originated from the internet. To fix the issue:
- Browse to the folder where you unpacked your dll files
- Right click all of them (or at least the ones you wish to use) and click 'Properties'
- In the 'General' tab at the button, click the 'Unblock' button
- Don't forget to click Apply and/or OK, otherwise it won't save.
This fixed the problem for us!
May 2, 2013 at 4:27 PM
Edited May 2, 2013 at 4:27 PM
A variation on the fix suggested by Rbottema is to "unblock" the NodeXLClassLibraries_1.0.1.nnn.zip file after you download it. Then when you unzip the file, all the unzipped files will be unblocked as well.