Hi,
I trying follow document:
https://help.syncfusion.com/wpf/sfdiagram/node
To use C# code to generated the node, but it seen not working as expect.
It just show the node area.
Please assist, thanks!
Windows 10 1709
Visual Studio 2017 15.5.1
.Net framework 4.7.02556
Syncfusion.SfDiagram.WPF runtime version v4.0.30319
The code behind:
public MainWindow()
{
InitializeComponent();
//Creates the Node collection
ObservableCollection nodes = new ObservableCollection();
Style style = new Style(typeof(Path));
style.Setters.Add(new Setter(Path.FillProperty, Brushes.DarkCyan));
style.Setters.Add(new Setter(Path.StrokeProperty, Brushes.Black));
style.Setters.Add(new Setter(Path.StrokeThicknessProperty, 2d));
style.Setters.Add(new Setter(Path.StrokeDashArrayProperty, new DoubleCollection() { 5 }));
style.Setters.Add(new Setter(Path.StretchProperty, Stretch.Fill));
//Create Node
NodeViewModel node = new NodeViewModel()
{
//Sets the size
UnitWidth = 100,
UnitHeight = 100,
//Sets the position
OffsetX = 200,
OffsetY = 200,
//Customizes the appearance
Shape = new RectangleGeometry() { Rect = new Rect(0, 0, 10, 10) },
ShapeStyle = style
};
//Adds the Node to the SfDiagram
nodes.Add(node);
diagram.Nodes = nodes;
}
xaml: