Creating a custom user interface often requires tailoring components to fit your application’s specific design language. In this guide, we’ll walk you through how to build and style a WPF virtual keyboard from the ground up, using the powerful MindFusion’s WPF Virtual Keyboard component. The result will be a beautiful, resizable keyboard with custom icons, animations, and a clean, maintainable structure.
Tag Archives: wpf
Take Your WPF Apps Cross-Platform: Virtual Keyboard & Avalonia XPF
We are thrilled to announce a significant update for developers using our Virtual Keyboard for WPF: it is now fully compatible with Avalonia XPF! This development bridges the gap between your existing WPF applications and the world of cross-platform development, allowing you to reach a wider audience without rebuilding your UI.

Sankey diagram in WPF
In this post we’ll show one possible way of using MindFusion WPF Diagram with custom model objects, and will create a simple Sankey diagram as an example.
Continue readingDesign custom shapes with WPF Diagram
Watch here the video for this tutorial.
This tutorial will run you through the process of creating custom WPF diagram shapes using the built-in Shape Designer. Keep in mind that the Designer is intended as a sample and is limited in terms of functionality. The designer is available inside the installation of MindFusion.Diagramming for WPF but is also included in this tutorial for convenience. For the purposes of this tutorial, we will create an ‘AND Gate’ circuit diagram shape as illustrated by the following image:
Run the Shape Designer application through the ShapeDesign.exe. The Shape Designer opens up with a single rectangular shape ready to be modified.
The Shape Designer does not currently support shape renaming (remember, it’s just a sample), therefore create a new shape through the Shapes menu and name it ‘AndGate’.
Select the newly created shape from the list on the left. In the editor select the right segment of the shape’s rectangle and press the DEL button on the keyboard. This will delete the segment and make the shape triangular.
Adjust the end points of the shape segments so that it gets deflated on both sides. To adjust a segment, hover it with the mouse (so that its adjustment handles appear), then drag the handles.
Select the arc primitive from the list on the right side of the screen. Drag this primitive over the top segment of the shape (until it gets highlighted in red) then drop.
This will replace the line segment with an arc. Repeat the same process for the bottom segment of the shape.
Adjust the middle point of both segments so that the shape looks protruded. Then drag three line primitives from the list on the right to the editor pane. Be careful not to drop the primitives over existing elements because this will replace the elements.
Align the newly created line primitives with the existing shape.
From the list with anchor points at the right side of the application, drag two anchor points from the first kind (input only) and one anchor point from the second kind (output only) and drop them inside the editor. Align the anchor points with the end points of the line segments created in the previous step.
This will conclude the creation of the ‘AND Gate’ shape. You can test the shape in the preview diagram at the bottom of the screen.
Save the shape library. Using the same approach, recreate the other circuit shapes from the image above. The following screenshot illustrates the complete library.
The shape designer along with the shape library containing the circuit shapes can be downloaded from the link below:
You are welcome to ask any questions about the WpfDiagram control at MindFusion discussion board or per e-mail at support@mindfusion.dev.
Click here here to visit the official page of the control.
We hope you find this tutorial useful and thank you for your interest in MindFusion developer tools.
Custom Templates With the WPF Diagram Control
In this blog you will learn how to create a presentation of a hierarchical organization using MindFusion WPF Diagram control. The hierarchy is presented as a diagram, where each node represents an employee in the organization and each link represents the direct relationship between employees. The nodes in the diagram use custom templates to give a more detailed description of the employee, as well as to enable editing of various properties.
Setup
Create a new WPF application and add the necessary assemblies to the project. In the main window, declare the following namespace:
xmlns:diag="http://mindfusion.dev/diagramming/wpf"
Then declare an instance of the DiagramView class inside the root grid:
<diag:diagramview x:name="diagramView"> <diag:diagram x:name="diagram" backbrush="White"> </diag:diagram></diag:diagramview>
Creating the custom node
To create the custom node, from the “Project -> Add New Item” menu add a new CustomControl (WPF) item to the project. This automatically creates a themes folder inside the project and a generic.xaml resource dictionary, which contains the template of the newly added class. Rename the newly created file (and class) to OrgChartNode. Ensure that the new class derives from TemplatedNode rather than Control. Then define the following dependency properties in the class: Title, FullName, and Image, of types string and ImageSource respectively.
Define the appearance of the node in its template in the generic.xaml file. In this case the node will display a round border, an image of the employee, its title, name, and description, and several buttons that can be used to change the role of the employee or add subordinates. The components bind directly to the properties of the node class. For example:
<textbox acceptsreturn="False" fontfamily="Verdana" fontsize="12" borderbrush="Transparent" background="Transparent" text="{Binding FullName}"></textbox>
The complete listing of the node’s template can be found in the project below.
To handle the Click event of the buttons in the template, register a routed event handler in the OrgChartNode class:
AddHandler(Button.ClickEvent, new RoutedEventHandler(OnClick));
...
void OnClick(object sender, RoutedEventArgs e)
{
...
}
Declare an Index property in the OrgChartNode class, which will indicate the role of the employee. Changing the role will automatically update the title and background color of the node:
public int Index
{
get { return Images.IndexOf(Image); }
set
{
if (value != -1)
{
Image = Images[value];
Title = Titles[value];
Brush = Fills[value];
}
else
{
Image = null;
}
InvalidateVisual();
}
}
Create the hierarchy
Now that the custom node is ready, we can create a diagram representing the hierarchy. In the code behind of the main window, create a series of OrgChartNode objects, each representing an employee in the organization, then link the nodes using the CreateDiagramLink method of the diagram Factory class:
var node1 = new OrgChartNode
{
Bounds = new Rect(0, 0, 300, 160),
FullName = "Mike Powell",
Text = "This is the leader of the sample organization.",
Index = 2
};
diagram.Nodes.Add(node1);
var node2 = new OrgChartNode
{
Bounds = new Rect(0, 0, 300, 160),
FullName = "Emily Williams",
Text = "Emily is the leader highest in the PR hierarchy.",
Index = 1
};
diagram.Nodes.Add(node2);
...
diagram.Factory.CreateDiagramLink(node1, node2);
Finally, arrange the hierarchy by using the built-in tree layout:
TreeLayout layout = new TreeLayout(); layout.Type = TreeLayoutType.Centered; layout.LinkStyle = TreeLayoutLinkType.Cascading3; layout.Direction = TreeLayoutDirections.TopToBottom; layout.KeepRootPosition = false; layout.LevelDistance = 40; layout.Arrange(diagram);
The following image illustrates the result:
The source code of the project together with all necessary libraries can be downloaded from here:
Download Organization Hierarchy Sample
You are welcome to ask any questions about the Diagram control at MindFusion discussion board or per e-mail at support@mindfusion.dev.
Click here here to visit the official page of the WPF diagram control.
We hope you find this tutorial useful and thank you for your interest in MindFusion developer tools.













