Diagram elements in WpfDiagram are represented by instances of the DiagramNode and DiagramLink classes. Combined and linked together, they can form complex data structures such as process or entity-relationship diagrams, class hierarchies, networks and graphs. Each of their rich features can be customized through numerous methods and properties. WpfDiagram also offers intuitive user interface for drawing and editing diagram items interactively.
Shape nodes can represent geometric shapes, flowchart elements, icons in network diagrams, and so on. They can display both graphics and text in different fonts, sizes and colors. There are more than 100 predefined node shapes (you can preview them here) and apart from them, WpfDiagram offers an easy way to define custom shapes. Shape nodes can be rotated, either interactively using the round selection handle drawn above them, or programmatically using the RotationAngle property. ShapeNode appearance can be customized further using several types of custom painting. The first type gives you full control over the painting. With the second one your painting code is performed additionally to the basic painting. The third one performs standard drawing of nodes and custom drawing of their shadows.
The SvgNode class represents nodes that display SVG drawings, in addition to the rendering provided by the base ShapeNode class. A node's SVG drawing is rendered after its associated bitmap Image. Set the Transparent property of base type to hide the node's Shape geometry and draw only SVG graphics. The SVG drawing that should be shown inside an SvgNode is specified through the node's Content property. SVG graphics are loaded and associated with the node through an SvgContent object, which should be initialized and then assigned to this property.
The TemplatedNode class represents nodes whose appearance is set through Xaml data templates. This class is useful mostly as a base type of custom nodes, as shown in tutorials 3 and 4. However it is not abstract and can be used directly if the text -related properties defined in DiagramItem are sufficient for your purposes. The appearance of such nodes can be set through their Template property or the NodeTemplate property of the Diagram class.
Tables can be used to represent table schemas in database diagrams or classes in class-hierarchies. A table contains cells arranged in a grid, and every cell can display text and/or image. Cells can span several rows and columns as set in the RowSpan and ColumnSpan properties. Cells, columns and rows can be customized in various ways - there are properties available for setting their extents, style, image and text alignment. Tables' dimensions can be programmatically changed; inserting, appending or deleting rows and columns can be done in a very comprehensive, intuitive way whenever you might need it. Tables can also display background images and graphics. The file formats supported are BMP, GIF, JPEG, ICO and WMF (the same applies for shape nodes).
A ContainerNode can contain other diagram nodes. When a container is moved, the contained nodes move too. Containers can be folded to hide the contained nodes, and unfolded back to show them again. Nodes inside a container can be linked to nodes both inside and outside of it. When a container is folded, the links connected to contained nodes point to the container outlines. Containers can be nested within each other to unlimited depth.
The TreeViewNode class represents nodes that can display hierarchical data. The root items displayed in the node can be accessed through the RootItems property. New items can be added to and removed from the returned collection. The root items can have child items on their own and so on. For more information, refer to the TreeViewItem class.
The diagram can display shapes from stencil files in Visio 2003 XML stencil format (.vsx). To load a stencil file, use an instance of the VisioStencil class. The shapes are displayed in the diagram through VisioNode objects. To associate a stencil shape with the node, create an instance of the VisioContent class and assign it to the node's Content property. Note that standard stencils installed with Visio are copyrighted by Microsoft, and you should not use them in your application. This feature is intended to let you use public domain stencils, or commercial clipart you have purchased a license for.
Links are used to represent various types of connections and relations in diagrams. WpfDiagram offers three basic link types:
A link can be connected to a node at each of the link's ends. It is also possible to have unconnected links - having one or both of their ends not connected to nodes. Some customizable link's properties are: arrowheads, Shape, color, text, pen width and style, modification behavior and number of segments.