This tutorial demonstrates how to use MindFusion.Diagramming components.
To create a composite node simply instantiate from the CompositeNode class. Currently the diagram does not provide a factory method for composite node creation. Therefore you need to manually add the newly created composite node to the list of diagram nodes. The sample below references the diagram1 variable, which identifies the Diagram object.
C#
![]() |
---|
CompositeNode node = new CompositeNode(diagram1); |
Visual Basic
![]() |
---|
Dim node As new CompositeNode(diagram1) |
Now that the node is created and added to the diagram we can create its contents. For the purposes of this tutorial we will create a horizontal StackPanel containing a TextComponent, an EditComponent and a ButtonComponent.
C#
![]() |
---|
StackPanel panel = new StackPanel(); |
Visual Basic
![]() |
---|
Dim panel As New StackPanel() |
Now add the newly created components to the previously created composite node:
C#
![]() |
---|
node.Components.Add(panel); |
Visual Basic
![]() |
---|
node.Components.Add(panel) |
Running the tutorial at this point should display a simple composite node the three components arranged horizontally.
To set the focus on the edit initially, simply set its IsFocused property to true. Note that in order to have effect this property has to be set after the component is added to the CompositeNode. Disconnected components cannot receive input focus.