Search
Document-View Architecture

MindFusion.Diagramming implements the Model-View-Controller (MVC) architectural pattern. The MVC design pattern as applied to MindFusion.Diagramming separates the diagram data (model) from its representation to the user (view) and controlling it by the user (controller).

The Diagram class represents the diagram data model and provides operations to process the data. It exposes properties and methods for adding new diagram elements, finding and accessing existing elements, or removing them.

The DiagramView class presents the relevant data from the Diagram class by drawing on the screen using the cross-platform Microsoft.Maui.Graphics API. When the diagram is changed, the view automatically redraws the affected part of the image to reflect the changes. Multiple views can display the same diagram, set by their Diagram property. Each view can have a different zoom level and scroll position.

The Controller part of the MVC is implemented by classes from the Interaction namespace, whose instances are switched by setting view's Behavior property. Behavior classes create controllers based on current input coordinates and diagram contents, and controllers either create new items or modify existing ones by processing further input events.