I previously pointed out how easy it was to manipulate and then render a .dgml file in the upcoming VSTS 2010 Architecture product. I want to continue that discussion by showing how easy it is to indicate to the product that you need to see nodes contained inside another, and a few other niceties along the way.

NOTE:

I do need to make one thing clear before we move forward. The difference between the core DGML and the additional capabilities you will find in the Architecture product is significant. The core DGML markup is limited to very few elements: DirectedGraph, Nodes, Node, Links, Link, Categories, and Category. Any additional markup beyond those basic elements is specific to the VSTS Architecture product.

So we had previously started with a graph that looked like this:

image

In order to tell the VSTS 2010 Architecture product's DGML rendering engine to draw a container around the "From" node, you first start by adding another Link element that has the Source attribute named "My Container" ( value doesn't matter ), and the Target attribute's value set to "From" ( this value does matter ). When you add that to your graph, you'll see this:

image

Not exactly containing the "From" node at this point, but we're not done. We need to add two more things to the markup.

The first step is to add a Category element to the Link element we just added, with a value of "Contains". Markup should now look like this:

image

The second step is to add a Nodes element with a single Node element contained inside, like so:

image 

The resulting graph looks like this:

image 

Let me point out a number of things, and bring them to your attention. In the image below, I've selected the contained "From" node:

image

  1. This is a number that indicates how many nodes are actually contained in the container.
  2. The Id of the container. The Id must match the Source attribute value of the Link element that has the "Contains" Category attribute applied to it. You can further include a Label attribute to the Node element in order to use a different value for the container's title than the Id value. VSTS 2010 Architecture defaults to the Id value when the Label attribute is not present.
  3. A chevron that can be clicked resulting in a collapsed or expanded container. The container in this example is clearly expanded, allowing you to see the contents of the container in the graph. The expanded state is captured in the dgml file via the value of the Group attribute on the Node element set to "Expanded". Setting that value to "Collapsed" collapses the container, hiding its contents. Here's a shot that shows the results of setting that value to "Collapsed" as well as using the Label attribute on the Node element:
    image
  4. This is showing that I have selected the "From" node.
  5. Because I have selected the "From" node, the link between the "From" node and "To" node shows up. If you aren't selecting "From" or the "To" nodes, that link disappears.

That's it! I should also add that you can have as many levels of containment as you'd like. Hope that helps!

Cameron