Reputation: 11889
I have got the latest DGML schema and generated a set of c# classes via xsd.exe but I can't see how to programatically add custom properties to a node.
The XML would look something like:
<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="_85" Label="MyNode" CustomProperty="XXX" />
</Nodes>
<Properties>
<Property Id="CustomProperty" Label="YYY" Group="ZZZ" />
</Properties>
</DirectedGraph>
How do I add CustomProperty
attributes to the Node
?
Upvotes: 0
Views: 214
Reputation: 1789
You can absolutely defined custom properties, but they are "metadata" not something you will see on the graph itself. They contain type information about the property which can affect how the respond to those values. Here's an example. If you select the Link with the custom Priority property the F4 property window will show the metadata about that property.
<DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="Banana" UseManualLocation="True" />
<Node Id="Test" UseManualLocation="True" />
</Nodes>
<Links>
<Link Source="Test" Target="Banana" Priority="10"/>
<Link Source="Test" Target="Green" />
</Links>
<Properties>
<Property Id="Bounds" DataType="System.Windows.Rect" />
<Property Id="UseManualLocation" DataType="System.Boolean" />
<Property Id="Priority" DataType="System.Double"
Label="Poobar" Group="Metrics"
Description="A fun new property"/>
</Properties>
<Styles>
<Style TargetType="Link">
<Setter Property="Weight" Expression="Priority * 3" />
</Style>
</Styles>
</DirectedGraph>
Upvotes: 0