The list below describes past changes and additions to WpfDiagram:
New PatternRouter class routes links by applying patterns of segment and turn sequences and accepting them when resulting paths do not cross nodes. A path is accepted if its final segment ends in target point and is orthogonal to respective side of target node. If there are several possible paths, the router selects the shortest one. The MinimumDistance property specifies minimum allowed distance of link segments from nodes. The PreferredDistance property specifies distance of first or last link bend from associated node. PatternRouter includes several predefined patterns designed to create consistent-looking paths, and allows creation of custom patterns. Custom patterns can be defined as sequence of RouteStep objects specifying whether the path advances by relative or absolute distance, or changes direction:
C# Copy Code |
---|
var rightZigzag = new RoutePattern(); |
The CompositeRouter class lets you chain link routers (objects implementing ILinkRouter interface) so that a link passes through the sequence until it gets routed successfully. Diagram's default router is now set to a CompositeRouter instance containing a PatternRouter and GridRouter sequence. This applies the several standard pattern paths when possible, and otherwise routes links using the cost minimizing heuristics-based grid router.
The NodeLabel class allows multiple captions to be displayed for a single DiagramNode of any type. Node labels provide a set of properties allowing full customization of their display and positioning. Label position is defined by specifying a pin point and offset from it, set through SetCornerPosition, SetEdgePosition, SetCenterPosition methods. In addition, the TextAlignment and TextVerticalAlignment properties of NodeLabel specify on which side of pin point to draw the label's caption.
For example, following code adds extra labels to top-left and bottom-right corners of a ShapeNode:
C# Copy Code |
---|
var node = diagram.Factory.CreateShapeNode(30, 70, 80, 60); |
The distribution now includes assemblies for .NET 6. Automatic VS toolbox integration is not available at this time; you must add diagramming.wpf assembly references to the project manually or through Nuget, and then add corresponding elements to Xaml markup for the various controls from the library.
Set the Scrollable property of ContainerNode to let users scroll the container's contents. The node then displays scrollbars at right and bottom edges that can be used to scroll interactively. The ScrollX and ScrollY properties let you determine current scroll position or change it programmatically. Note that in order to let container's content overflow and become scrollable, you must either disable AutoGrow, or allow users reduce container size by changing HandlesStyle and EnabledHandles properties from their default MoveOnly / Move values.
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 SvgImporter class allows importing Scalable Vector Graphics files (*.svg) into MindFusion.Diagramming. Each top-level SVG group element is imported as a separate SvgNode, whose Content is set to the group's child elements. If the SVG file was exported from Visio or OpenOffice Draw, SvgImporter will create DiagramLink objects for groups it recognizes as connectors in order to recreate the original diagram model, though in this case it will not preserve fully the original appearance of connectors in SVG.
BarcodeNode now supports barcodes in code 128 format.
The control now supports several ways to zoom using lasso tool:
The Behavior property setter no longer clears current selection. Call the SetBehavior method with true argument instead if you need selection cleared too.
The distribution now includes assemblies for .NET 5. Automatic VS toolbox integration is not available at this time; you must add diagramming.wpf assembly references to the project manually or through Nuget, and then add corresponding elements to Xaml markup for the various controls from the library.
The FishboneDiagram controls creates Ishikawa diagrams (a.k.a. fishbone or cause-and-effect diagrams) from specified data source. Fishbone diagrams are used to display causes of manufacturing effect / defect / event, grouped in categories, and arranged as ribs around a backbone. The FishboneDiagram control creates a category branch (rib) for each item specified in the ItemsSource property. Category labels are obtained from the items' property specified by LabelPath. The causes in a category are obtained from the collection-property of items specified via CausesPath. If the collection contains strings, they are displayed directly as labels in respective branch. If causes are data objects, their labels are obtained through CauseLabelPath.
The distribution now includes assemblies for .NET Core 3.1. Automatic VS toolbox integration is not available at this time; you must add diagramming.wpf assembly references to the project manually or through Nuget, and then add corresponding elements to Xaml markup for the various controls from the library.
NodeModifying and LinkModifying events are now also raised for items in multiple-selection.
ArrangeAnimated methods added to Diagram and ContainerNode classes animate the movement of items from their original locations to new locations assigned by the layout object. This can be used to create an explode effect by starting new layout from overlapping nodes on same position, or an insertion effect by adding a new node to an existing layout.
Diagrams can now be serialized in JSON format. This can be used for interoperability with MindFusion JavaScript diagramming library, or for general storage in JSON files or databases. To serialize a Diagram to a JSON string, call its SaveToJson method. To deserialize a diagram back from its JSON representation, call the LoadFromJson method. Custom item classes can implement JSON serialization for their additional properties by overriding the SaveToJson and LoadFromJson methods of DiagramItem. Such classes must be registered for serialization by calling the RegisterItemClass method and providing a string identifier for the clientClass parameter.
DxfExporter exports diagrams to AutoDesk Drawing Exchange Format (DXF) files. In order to use this component, add a reference to the MindFusion.Diagramming.Wpf.DxfExport.dll assembly to the project. To create a DXF file from a diagram, create a DxfExporter instance and call its Export method, specifying a Diagram object and a file path as arguments.
The ExcelExporter class from MindFusion.Diagramming.Wpf.ExcelExport.dll assembly exports diagrams to Excel Open XML Format (XLSX) files. Diagrams are exported as Excel AutoShapes drawings. The Export overload that takes a DiagramDocument parameter creates a sheet for each DiagramPage in the document. The Export(Diagram) overload creates a single Excel sheet.
All graph layout classes now contain an async ArrangeAsync method that runs layout calculations in a background task. This is only available in .NET 4.5 build of the diagram assemblies.
C# Copy Code |
---|
async void OnLayoutLayered(object sender, RoutedEventArgs e) |
The shape of a ShapeNode can be flipped horizontally or vertically. Enable the AllowFlip property and the shape flips when an edge is dragged over its opposite edge. You can get or set current flip state using FlipX and FlipY properties.
Extension methods in MindFusion.Diagramming.Wpf.Fluent and MindFusion.Diagramming.Wpf.Layout.Fluent namespaces let you initialize objects using fluent programming style:
C# Copy Code |
---|
using MindFusion.Diagramming.Wpf.Fluent; |
The ShapeListBox control displays a list of Shape icons along with their DisplayName. It lets users drag-and-drop a Shape to the diagram's canvas to create a new ShapeNode. Set the ItemsSource property to an array or collection of shapes that should be rendered inside the control. For example, setting the Shape.Shapes list as ItemsSource will show all pre-defined shapes. You can customize the shape appearance by setting ShapeBrush and ShapeSize properties.
A FreeFormNode collects all points from users' mouse or touch input and displays them as node's outline. To let users draw free-form nodes interactively, set Behavior to DrawFreeForms or LinkFreeForms. Use the Points property of FreeFormNode to get or set outline points programmatically. If the Closed property is set, the node is drawn as a closed shape and its interior filled, or otherwise the node is drawn as a poly-line. If the distance between first and last points drawn by user is shorter than AutoCloseDistance, the node's Closed property is automatically set to true. AutoCloseDistance default value is Double.MaxValue, so free-form nodes are always closed.
Additional drawing modes, convenient for touch input, convert FreeFormNode objects drawn by user to ShapeNode objects with most similar shape. To enable them, set Behavior to DrawFreeShapes or LinkFreeShapes. The shapes against which the user's input is matched are set via diagram's FreeFormTargets property. By default it contains Rectangle, Decision and Ellipse shapes.
Shape formulas can now be parameterized by associating control points with Shape objects. Each control point is passed to the shape script as a named variable. Apart from the name, you can specify the default, min and max coordinates for each parameter via the ShapeControlPoint constructor, and whether to treat its values as percents or fixed offset.
Adjustment handles are no longer identified by integer values but by instances of AdjustmentHandle -derived classes. This changes the signatures of HitTestHandle methods and the InteractionState constructor. Standard handle classes included are NodeAdjustmentHandle for changing a node's position and size, LinkAdjustmentHandle for changing link control point positions, ShapeAdjustmentHandle for adjusting shape formula parameters, and FreeFormHandle for changing the position of a FreeFormNode outline point.
The BarcodeNode class displays EAN, UPC or QR barcodes as node's content. In-place edit operations let users enter new numeric codes for 1D codes or text strings for QR codes. The barcode format is specified via the Format property, the encoded number or text is set via Content, and color of 1D bars / 2D modules via BarColor.
The diagram can now 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.
There is no separate trial build of the control assemblies anymore. Instead, set the LicenseKey property of Diagram or DiagramDocument to disable the component's evaluation mode and stop displaying trial messages. If your application contains more than one Diagram instance or other controls by MindFusion, you could call MindFusion.Licensing.LicenseManager.AddLicense(key) from application start-up code to specify the key once instead of setting it per each control. License key strings are now listed on the Keys & Downloads page at MindFusion's customer portal.
The ShapeDesigner component implements a vector-drawing canvas where Shape definitions can be created interactively. Call the ImportShape method to open a shape for editing. Call the ExportShape method to create a Shape with specified Id from current content of the designer canvas. ShapeDesigner shows a palette with two kinds of elements: Primitives which when dropped on the canvas add a single curve or line segment, and Templates which when dropped on canvas add a closed path of several graphic primitives.
The following properties have been converted to dependency properties:
Tree maps represent hierarchies by nesting child nodes within their parents, where the areas of leaf nodes are proportional to their Weight values. Unlike other layout algorithms, TreeMapLayout expects hierarchies to be defined via grouping or containment (see AttachTo method and ContainerNode class), and will ignore any links in the diagram. The diagram area covered by the topmost nodes in a hierarchy is specified via the LayoutArea property. By default, the layout tries to keep the ratio of node sides as close as possible to one. However this could make it hard to distinguish separate levels of the hierarchy. To alleviate that, set Squarify to false, and child nodes will be arranged either as a row or a column inside their parent node, alternating directions for each level. The drawback is that when Weight ratios differ greatly or nodes contain many children, some nodes could end up with very narrow rectangles.
DecisionLayout arranges simple flowcharts consisting of decision boxes with up to three outgoing links per node and activity boxes with a single outgoing link per node. The nodes are arranged in columns and rows, whose distance depends on the HorizontalPadding and VerticalPadding property values. When links share the same row or column, they are placed at a distance specified via LinkPadding. The layout arranges nodes recursively starting from StartNode. If StartNode is not specified, the algorithm selects the root of the deepest branch of the graph's spanning tree as start node.
Layout algorithms now automatically resize diagram's Bounds if it's not large enough to fit the arranged content. To revert to old behavior and keep fixed Bounds size, set GrowToFit to false.
The Visio2013Exporter class can export the content of Diagram and DiagramDocument objects to Visio 2013 VSDX files. In order to use it, add a reference to the MindFusion.Diagramming.Wpf.VisioExport.dll assembly. Similarly to the VDX format exporter, Visio2013Exporter relies on a template file, called Visio2013.vxt, containing some boilerplate Visio XML code. The template must be either located in same folder as the application assemblies, or its path must be specified via the TemplatePath property. At this time the exporter supports shapes from Visio basic stencil.
The Visio2013Importer class can import .vsdx files, created by version 2013 of Microsoft Visio. In order to use it, you must add a reference to the MindFusion.Diagramming.Wpf.VisioImport.dll assembly. Various overloads of the Import method can be used to import the Visio drawing into a DiagramDocument whose pages correspond to the Visio pages, or into a single Diagram whose content is merged from all imported pages. When merging multiple pages, their positions in the diagram depend on the PagesPerRow value. Visio2013Importer supports Visio's basic flowchart and data flow stencils. For each node shape from the .vsdx file, the importer creates a ShapeNode object whose Shape, Text, Brush and Stroke properties are set to values corresponding to the imported Visio shape. For each connector shape, the importer creates a DiagramLink object whose Origin and Destination are set to the corresponding imported nodes, and whose ControlPoints reflect the geometry of the connector.
The MindFusion.UI.WpfZoomControl class lets user change interactively the current zoom level and scroll position of a Diagram or DiagramView. To set it up, add a MindFusion.UI.WpfZoomControl to the window, place it anywhere over the target diagram, and set the control's Target property to that diagram or view. Set the ZoomStep and ScrollStep properties to specify the amount added to view's zoom level or scroll position by MindFusion.UI.WpfZoomControl's buttons. You can customize the control's appearance by setting properties such as Fill, Stroke, CornerRadius and TickPosition.
The DrawImporter class can import .odg files, created by the OpenOffice Draw vector graphics editor. In order to use it, you must add a reference to the MindFusion.Diagramming.Wpf.DrawImport.dll assembly. Various overloads of the Import method can be used to import the OpenOffice drawing into a DiagramDocument whose pages correspond to the Draw pages, or into a single Diagram whose content is merged from all imported pages. DrawImporter supports shapes from the General and Flowchart shape palettes in Draw. For each node shape from the .odg file, the importer creates a ShapeNode object whose Shape, Text, Brush and Stroke properties are set to values corresponding to the imported OpenOffice shape. For each connector shape, the importer creates a DiagramLink object whose Origin and Destination are set to the corresponding imported nodes, and whose ControlPoints reflect the geometry of the connector.
The DiagramView3D control lets you display the elements of a diagram in 3D space. Assign the Diagram that should be displayed in this view to the Diagram property. DiagramView3D adds a 3D model to the scene for each node or link of the specified diagram. The positions of nodes in 3D coordinate space are specified via the Position3D attached property. Links are rendered as straight lines connecting the 3D node models. By default, nodes always face the camera, unless NodeRotationType is set to None.
VisioImporter allows importing Visio 2003 XML Drawing files (*.vdx) into WpfDiagram. The standard Visio flowchart shapes, as well as most of the UML and Database entity shapes are imported to their closest representation in the MindFusion.Diagramming object model. The Visio connectors are imported as DiagramLink objects, preserving the relationship between the connected nodes. In addition, most of the attributes of Visio objects such as text, text formatting, fill and line colors and styles are preserved. The component raises an event for each imported node to let you set the node shape if it is not recognized by MindFusion.Diagramming or if you need to set a different shape.
The Import method imports all Visio pages into a DiagramDocument, creating a DiagramPage for each page from the VDX. To determine how many pages there are in a Visio document and import only a single page, call the GetPageCount and ImportPage methods. All pages of a Visio drawing can be imported into a single Diagram by calling the ImportAllPages method, which lays out the pages as set in PagesPerRow.
The Balance property of TreeLayout can be set to Preserve to keep the original geometric order of child nodes when arranging them under their parent. This can be used to arrange tree branches in a specific order by first positioning them in increasing horizontal or vertical positions. Another possibility is to apply TreeLayout from NodeModified handler to let users rearrange the tree branches by dragging and dropping a node.
Two visual effects, represented by GlassEffect and AeroEffect classes, can be applied to nodes. To apply an effect, create an instance of the respective class, set up its properties, then add the instance to the Effects collection of a node (or to Diagram.NodeEffects collection to apply it to all nodes). Effects can be added, removed or modified at any time and this will immediately reflect on the diagram. Effects of different types can be applied simultaneously. It is also possible to apply more than one effect of the same type.
The Brush, Stroke* and Font* dependency properties no longer contain initial local values and will inherit style values without having to clear the local values first. The diagram now exposes a style property for each built-in node type, which allows creating global styles for nodes directly in the diagram's markup code in the Xaml page. The properties are called ShapeNodeStyle, TableNodeStyle, etc. and are of the WPF's standard Style type.
A theme in WpfDiagram is a set of styles, each associated with specific item type. When the theme is applied to a diagram, the styles registered in the theme affect all objects of their associated type. Themes are represented by the Theme class and can be assigned to Diagram objects through their Theme property. Styles are associated with item types within the theme through the RegisterStyle method. The package now includes a Theme Editor tool that provides simple visual environment for theme creation and modification. There are also several predefined themes available in the Themes subfolder of the installation root folder. For more information about this new feature, check Styles and Themes.
The DiagramDocument class represents a collection of diagram pages or sheets, represented by DiagramPage objects. DiagramPage is derived from Diagram and only adds a Title property, so any current code that processes Diagram objects will work with DiagramPage objects too. New pages can be added to the document and existing pages can be removed and reordered via the Pages collection. The diagram document provides higher level of events for the pages contained inside it. The document supports the notion of an active page.
The new TabbedDiagramView can be used to display DiagramDocument objects. The view displays tabs for the individual pages in the document. The active page can be changed interactively by activating its associated tab. New pages can be added and removed to/from the document through buttons in the tab tray and the pages can be rearranged by dragging their associated tabs with the mouse.
The OneWayLayout class ensures that links enter into nodes from the same general direction and exit them from the opposite side. If the graph contains cycles, some links bend around the nodes to keep the enter/exit direction consistent. The algorithm aims to minimize the number of such links.
The LinkLabel class allows multiple captions to be displayed for a single DiagramLink object. Link labels provide a set of properties allowing full customization of their display and positioning. Labels can also be arranged automatically to avoid overlapping nodes and other labels by setting LinkLabel.AutoArrange to true.
Items can now be assigned to layers, and layers can be hidden, locked or moved up/down in the Z order as a group. Set the LayerIndex property of items to associate them with layers in the Diagram.Layers collection. The Layer objects provide Visible, Locked and ZIndex properties, which will affect all items in the respective layer. Layers also expose a Title property shown in the LayerListView control. Newly drawn items are added to the layer specified via Diagram.ActiveLayer. For additional information about layers, refer to Layers.
The LayerListView control provides user interface for working with Layer objects. The control displays a list of all layers in a specified Diagram with a title and an overview area, and also allows editing of layer's Title, Visible and Locked properties and choosing the Diagram's currently active layer. New layers can be added to the Diagram by clicking the '+' button. The selected layer can be deleted by clicking the '-' button.
The .NET 4 version of WpfDiagram takes advantage of the Task Parallel Library (TPL) to enable parallelism on the different layout algorithms. Set the EnableParallelism property on the Layout class to true to enable arranging different subgraphs on different threads to possibly improve performance on multiprocessor systems. In addition, the maximum degree of concurrency can be manipulated through the MaxDegreeOfParallelism property. Note that only independent subgraphs are processed in parallel, so the SplitGraph property of layout classes that provide it must also be set.
The new magnifier tool allows users to interactively zoom in (or out) portions of the diagram by holding down a modifier key or pressing a mouse button. The magnifier's zoom factor and appearance can be customized. Additional information can be found in the corresponding section of Scrolling and Zooming.
VirtualizingDiagram can display very large diagrams where there are actual DiagramNode and DiagramLink instances created only for the elements that should be currently shown on screen. This helps keeping the WPF visual tree small and could lead to huge performance improvements if there are thousands of elements in the diagram.
The data items that should be displayed as nodes must be assigned to the NodesSource property, and the data items that should be displayed as links must be assigned to the LinksSource property. The BindingMode property specifies whether the data source should be updated when the user draws new diagram items interactively.
If AutoAlignNodes is enabled, the node currently being drawn or resized is aligned to another node so that a pair of their vertical or horizontal sides become collinear. To specify the maximal distance at which nodes are aligned, set the AutoAlignDistance property. The pair of aligned nodes is indicated visually by drawing an alignment guide using the pen assigned to AlignmentGuidePen.
FractalLayout is a tree layout algorithm that places child nodes symmetrically around their parent node. Nodes at the lowest level are arranged directly in a circle around their parent. At the upper level, the already arranged nodes form branches that are arranged in a circle around the new parent node. The algorithm is recursively repeated till the highest level is reached. If nodes in the tree have uniform number of children, the end result has fractal-like appearance (subsets of the graph look like scaled-down copies of the whole graph).
You can choose which node should be displayed at the center of the topmost circle by setting the Root property. If it is not specified, the algorithm automatically selects a root that leads to more balanced distribution of nodes.
CompositeLayout partitions the diagram into several subgraphs and applies the algorithm specified via the SubgraphLayout property on each part. If the part is a tree, it is arranged using the algorithm specified via the SubtreeLayout property, which is set to a radial TreeLayout instance by default. Finally the algorithm specified via MasterLayout is applied on the graph that represents the overall partition. By running the polynomial-complexity layout algorithms on small subgraphs, CompositeLayout is able to process a large graph much faster than if a layout algorithm is applied on the whole graph.
CompositeLayout can run on custom partitions specified as lists of nodes, or automatically partition the diagram via two automatic methods based on graph connectivity and graph path lengths. Set the PartitionMethod and CustomPartition properties to specify how the diagram should be partitioned.
VisioExporter exports diagrams to Visio 2003 XML Drawing files (*.vdx). ShapeNode objects are mapped to their closest Visio counterparts and TableNode objects are exported as groups of Visio shapes. DiagramLink instances are exported as Visio connectors of a similar style. In addition, most of the attributes of diagram items such as text, text formatting, fill and line colors and styles are preserved. The exporter object requires the VisioExport.vxt file to be present in the application's directory. This file contains an XML template used by the component to generate Visio documents.
Now links can automatically connect to the nearest diagram node without the mouse pointer reaching the node. This is enabled by setting the AutoSnapLinks property. The maximum distance at which auto-snap works can be specified through AutoSnapDistance. The SnapToNodeBorder property, which implemented similar functionality when the mouse is directly over a node, has been removed.
By default, the algorithm works with the diagram's LaneGrid, but its SwimlaneGrid property can be set to any class that implements ISwimlaneGrid. This allows applying the layout to a custom-drawn grid rendered through a custom control template, or one composed of locked background nodes.
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.
The WmfExporter class creates a Windows Metafile (WMF) drawing from the content of a Diagram. The exporter enumerates all graphics primitives contained in the WPF visual tree and creates corresponding WMF records. This enables custom graphics and hosted controls to be rendered in WMF too. To use WmfExporter, add a reference to the MindFusion.Diagramming.Wpf.WmfExport.dll assembly to your project.
The SvgExporter class creates a Scalable Vector Graphics (SVG) drawing from the content of a Diagram. The exporter enumerates all graphics primitives contained in the WPF visual tree and creates corresponding SVG elements. This enables custom graphics and hosted controls to be rendered in SVG too.
This version enables styling of diagram items through the WPF styling system. Now DiagramItem provides a Style property, which can be set to an instance of the System.Windows.Style class. The style can contain setters for the Brush, Stroke*, Text* and Font* dependency properties that were introduced in the last release. Using the style's TargetType attribute it is also possible to define a global style in the window or application resource dictionaries for each type of node.
The Font property of diagram nodes, table cells and treeview items is deprecated. The DiagramItem class now exposes FontFamily, FontSize, FontStretch, FontStyle, FontWeight and TextDecorations dependency properties. This enables better support for the WPF animation and styling features. The Cell and TreeViewItem classes now derive from a common TextPresenter class that provides the same font properties as DiagramItem.
The TextFormat and CaptionFormat properties are now deprecated. They have been replaced by the TextAlignment, TextVerticalAlignment, TextWrapping and TextTrimming properties defined in DiagramItem. In addition, there is a new TextPadding property that specifies the padding of text within the text's bounding rectangle. The same properties are exposed by TextPresenter - the new base class of the Cell and TreeViewItem classes.
The Pen property of DiagramItem is deprecated. It has been replaced by Stroke, StrokeThickness, StrokeDashStyle, StrokeDashCap, StrokeStartLineCap, StrokeEndLineCap, StrokeLineJoin and StrokeMiterLimit. This enables better support for the WPF animation and styling features.
The type of the HeadShape, BaseShape and IntermediateShape properties of DiagramLink has been changed from enum ArrowHead to class Shape, which is also used to define ShapeNode shapes. The ArrowHeads class now exposes Shape definitions that correspond to the ArrowHead enumeration members from previous versions. It is also possible to assign any Shapes member or a custom shape as an arrowhead. When used for arrowheads, position (50, 0) in the shape definition corresponds to the arrowhead's tip point.
The ActiveItemHandlesColor, SelectedItemHandlesColor and DisabledHandlesColor properties have been replaced by ActiveItemHandlesStyle, SelectedItemHandlesStyle and DisabledHandlesStyle. The HandlesVisualStyle objects returned by them provide sub-properties for greater control over the appearance of selection handles. The adjustment handles can now be painted not only in solid color but with arbitrary brushes, such as LinearGradientBrush and ImageBrush objects.
The Query method of DiagramItem can be used to find items that can be reached from the current one by following a path described in the query expression specified as argument. The expression includes selectors separated by a / character, where each selector returns the items from the result set of the previous step. The expressions can also include boolean predicates that filter the results using boolean and arithmetic expressions.
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.
This version adds predefined Shape definitions that implement the Object Management Group / Business Process Management notation. They are available as members of the Shapes class and have names that start with a Bpmn prefix. They can also be accessed by ID using the FromId method of Shape.
FlowchartLayout recognizes program code-like patterns in the graph, such as loops, sequences and if/switch branchings, and arranges them recursively. FlowchartLayout could be used to arrange other types of graphs as well, though with some restrictions. For example it treats all back links as loops in the code, and expects that they are nested - loop links starting closer to the stop node should end closer to the start node. Another similar restriction is that there shouldn't be any cross-links that connect different branches of a decision sub-graph.
If the underlying graph if acyclic, TopologicalLayout arranges the nodes linearly in such a way that each node comes before all destination nodes of its outgoing links. The links are drawn as curves above the chain of nodes, with their height proportional to the distance between the nodes. If the graph is not acyclic, the layout algorithm finds an ordering with a minimal number of back links, and draws the back links below the chain of nodes.
A much faster link routing algorithm has been implemented. It can arrange a thousand links for just a few seconds, while older versions would require several minutes. Now it is also possible to create custom routing classes to be used when a link must be routed by implementing the ILinkRouter interface. An instance of such class can be set through the LinkRouter property of the Diagram. WpfDiagram provides two classes that implement ILinkRouter - GridRouter and QuickRouter. By default LinkRouter is set to a QuickRouter instance.
The DiagramView class lets you display several views of the same diagram, each having distinct zoom level and scroll position. You can assign the shared Diagram object to the Diagram property of the views, either programmatically, for example, from a Window_Loaded event handler, or by using databinding syntax in Xaml.
The SizeSyncMode property of DiagramNodeAdapter specifies how the size of the diagram node and the UIElement it hosts should be synchronized:
The OrthogonalLayout class implements an orthogonal graph layout algorithm. Each link is drawn as a chain of alternating horizontal and vertical segments. Nodes are placed in a way that facilitates few links bends and crossings. This algorithm was designed for planar graphs where the nodes have at most four incident links, and produces best results with such graphs as input. It can arrange any arbitrary graph as well, by adding some dummy nodes and links to planarize the graph and reduce its vertex degree, and removing them after the layout.
CircularLayout distributes nodes evenly on the circumference of a circle at positions that result in as few link crossing as possible. Set its Radius property to specify the size of the layout circle. Set SiftingRounds to set the number of fine-tuning crossing-reduction iterations.
The lane grid lets you emphasize the relationship between a group of diagram items by displaying them in a distinct lane or cell within the grid. To display the lane grid, set the EnableLanes property of the Diagram class to true. In order to customize the grid, set the various attributes exposed by the LaneGrid property, which lets you specify the number of rows and columns, add headers, customize the cell appearance, etc. The new Lanes sample project uses the lane grid to let users draw Gantt charts.
The ContainerNode class implements diagram nodes that can function as containers for other nodes. Containers can be folded to hide their content, and unfolded to show it again. Containers can be nested one within another, without limitation on the depth of nesting.
The Ruler control provides horizontal and vertical scales that helps users measure and align diagram items. In order to use the Ruler, it must be set as a parent of the Diagram object, that is the XAML element should contain the element. The control also implements a scrollable area and can be used instead of ScrollViewer.
NodeListView is a toolbox alike control. It displays a list of node templates, and lets user create new nodes based on these templates by drag-and-drop. NodeListView can contain instances of any DiagramNode or UIElement derived classes.
The PdfExporter class lets you exports diagrams to Adobe Portable Document Format (PDF) files. In order to do that, create a PdfExporter instance and call its Export method. If you need to set the page size and orientation, use the PageSize, and PageOrientation properties.