Hi,
Hi Paul,
Yes, what deep232 suggested is one possibility.
You might want to look at the value of Diagram.LinksSource in the debugger, to make sure it’s what you think it should be. It ought to be the same value as Diagram.Model.LinksSource.
Hi deep232/Walter,
Are you also specifying the Diagram.Model in XAML? If so, I could imagine there’s an issue with setting the Diagram properties in the wrong order. In that case you shouldn’t bind the Diagram.NodesSource or Diagram.LinksSource – instead you should bind the GraphLinksModel.NodesSource and GraphLinksModel.LinksSource directly.
Although I’m not sure how that would account for the LinksSource property values being correct in the debugger.
Hi Walter,
Hi,
I'm just looking at the video at http://www.youtube.com/watch?v=WTTepPE6joI&fmt=22 and he appears to be able to incorporate a model tag within his diagram tag , i.e. XAML such as the following: </go:UniversalGraphLinksModel>
</go:Diagram.Model>
</go:Diagram>
Are you using Silverlight or WPF? If Silverlight, are you using Silverlight 4?
It turns out that Silverlight 3 had a lot of little deficiencies in its XAML support. Most of the problems were fixed when they re-implemented XAML support in Silverlight 4. One of the deficiencies is in the declaration of namespaces.
If you are using Silverlight 4 or any version of WPF, you should declare the GoXam namespace using:
xmlns:go="http://schemas.nwoods.com/GoXam"
That will allow you to refer to classes in all of the GoXam namespaces using the “go:” XML namespace prefix. And you can remove all of the declarations like:
xmlns:go="clr-namespace:Northwoods.GoXam;assembly=Northwoods.GoSilverlight"
xmlns:gomodel="clr-namespace:Northwoods.GoXam.Model;assembly=Northwoods.GoSilverlight"
xmlns:gotool="clr-namespace:Northwoods.GoXam.Tool;assembly=Northwoods.GoSilverlight"
xmlns:golayout="clr-namespace:Northwoods.GoXam.Layout;assembly=Northwoods.GoSilverlight"
All of the Silverlight samples in the 1.2 kit were written to work with Silverlight 3. In the next kit we have changed the samples sources to assume Silverlight 4, so there will be very few differences with the WPF samples sources.
Hi Walter,
Hi Walter,
Sorry about that – I misled you.
Actually, models are not DependencyObjects, so their properties, including NodesSource and LinksSource, cannot be data-bound.
That’s why we added those two properties as dependency properties on Diagram.
Ok thanks. I’m still not sure why I cannot see my links when binding to my viewmodel despite it working fine when I use view ‘code behind’. When I use code behind however I populate the NodeSource and LinkSource properties using the object model rather than binding within XAML.
Jon-Paul.
I just tested this: I modified the Draggable Link sample to declare the Diagram.Model in XAML and having bindings of Diagram.NodesSource and Diagram.LinksSource to an object set as the page’s DataContext with properties named “Nodes” and “Links”. I commented out the code to create the model and initialize its NodesSource and LinksSource properties.
Everything worked fine. So I’m at a loss to explain why nodes are working for you but links are not.