Search
DiagramView Class
Remarks See Also
 





A WPF control that displays the content of a Diagram object.

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

 Syntax

C#  Copy Code

public class DiagramView : Control, IZoomTarget, InteractionTarget

Visual Basic  Copy Code

Public Class DiagramView
    Inherits Control
    Implements IZoomTarget, InteractionTarget

 Remarks

Render Diagram Items

DiagramView implements UI virtualization and adds elements to the WPF visual tree only for items that are placed inside current Viewport. The default item presenters are simple UIElements that call the Draw method of their bound item. You can create more complex presenters by setting the Template property of nodes, or by overriding the CreateRenderer method in custom node types.

Controlling Users' Actions

The Behavior property specifies how the control responds to user actions with the mouse. To apply a custom behavior class, set the CustomBehavior property. To enable creating links or nodes of your custom type interactively by using the CustomLinkType or CustomNodeType properties, set Behavior to Custom.

AllowInplaceEdit specifies whether users are allowed to edit the content of a diagram element in-place by double-clicking it. Set InplaceEditAcceptOnEnter to true to accept changes and exit inplace-edit mode by pressing ENTER. The InplaceEditCancelOnEsc property allows setting the inplace editing to be rejected by pressing ESC.

User actions can be validated by handling various diagram events, such as NodeCreating, NodeModifying, etc. Note that events are raised by the Diagram object to provide a single source to event handlers, rather than having ot subscribe to individual diagram items or views.

Some operations on the diagram can be bound to mouse buttons by setting flags in RightButtonActions and MiddleButtonActions. ModifierKeyActions allows changing the function of keyboard modifier keys such as the ALT, CTRL and SHIFT keys.

Modification of existing items can be customized by setting the ModificationStart property, which specifies how the user can start moving or resizing an item, and ModificationEffect, which specifies what visual effect to apply on items that are being modified.

Coordinate System

The zoom level of individual views can be set through their ZoomFactor property. Their scroll position is set through the ScrollX and ScrollY properties. These three properties together with diagram's MeasureUnit define a mapping between view's and diagram's coordinate systems. Call the ViewToDiagram or DiagramToView methods when you need to convert points between view's and diagram's coordinate systems.

 Inheritance Hierarchy

System.Object
    System.Windows.Threading.DispatcherObject
        System.Windows.DependencyObject
            System.Windows.Media.Visual
                System.Windows.UIElement
                    System.Windows.FrameworkElement
                        System.Windows.Controls.Control
                            MindFusion.Diagramming.Wpf.DiagramView

 See Also