Search
DiagramItem Class
Remarks See Also
 





Represents an item in the diagram document. All classes representing diagram elements derive from DiagramItem.

Namespace: MindFusion.Diagramming.Wpf
Assembly: MindFusion.Diagramming.Wpf

 Syntax

C#  Copy Code

public abstract class DiagramItem : FrameworkElement,
    IDisposable, ITextAttributes, InplaceEditable

Visual Basic  Copy Code

Public MustInherit Class DiagramItem
    Inherits FrameworkElement
    Implements IDisposable, ITextAttributes, InplaceEditable

 Remarks

All items in the diagram document - links and nodes - share common base class called DiagramItem. Its main function is to provide interface for the most common methods and properties, which every diagram element should have.

WpfDiagram invokes the Draw method when an item must be drawn on screen. You can call Draw if you need to draw an item on your own graphics surface. Override the method when implementing custom item types to provide your own rendering functionality.

The standard item types draw their interior using the brush assigned to the Brush property. The items borders are rendered using the attributes set through Stroke, StrokeThickness, StrokeDashStyle, StrokeMiterLimit, StrokeLineJoin and various Stroke*Cap properties.

The item's text is specified through the Text property. Its font attributes can be set through FontFamily, FontSize, FontStyle, FontWeight and FontStretch properties. Text layout attributes are specified via TextAlignment, TextVerticalAlignment, TextPadding, TextWrapping and TextTrimming.

The order in which items are painted from bottom to top is called the z-order. Moving items up or down the z-order can be done by means of the ZBottom, ZTop, ZLevelUp and ZLevelDown methods. Accessing and setting the index of an item in the z-order can be done using the ZIndex property.

An hierarchy of items can be built, so that moving an item that is higher in the hierarchy moves all subordinated items too. The immediate subordinates of an item are represented by a Group instance. The group of items attached to another item is accessed by the SubordinateGroup property of the latter. MasterGroup gets the group in which an item is subordinate.

It is possible to find items in specific relation to the current one by means of the Query method. Query can traverse the node/link graph connections and parent/child relationships in hierarchies, and filter the results by means of predicate expressions.

An application can associate custom data with an item by means of the Tag property. The tags are only meant to hold data related to the entities represented by the chart items. They are not used or modified by WpfDiagram in any way. The tags are saved and loaded together with the diagram elements when serializing the document to a disk file or a stream.

Items can be locked for interactive modification through the Locked property. Locked items can still be modified programmatically. Items can also be marked as locked for automatic layout methods by the IgnoreLayout property.

 Inheritance Hierarchy

System.Object
    System.Windows.Threading.DispatcherObject
        System.Windows.DependencyObject
            System.Windows.Media.Visual
                System.Windows.UIElement
                    System.Windows.FrameworkElement
                        MindFusion.Diagramming.Wpf.DiagramItem
                            MindFusion.Diagramming.Wpf.DiagramLink
                            MindFusion.Diagramming.Wpf.DiagramNode
                            MindFusion.Diagramming.Wpf.Selection

 See Also