Class PathElement
Represents the class which defines how to align the path based on offsetX and offsetY.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class PathElement : DiagramElement
Examples
<SfDiagramComponent Width="1000px" Height="1000px" @bind-Nodes="Nodes" SetNodeTemplate="SetTemplate">
</SfDiagramComponent>
@code
{
DiagramObjectCollection<Node> Nodes = new DiagramObjectCollection<Node>();
private CommonElement SetTemplate(IDiagramObject node)
{
if ((node as Node).ID == "node2")
{
DiagramCanvas container = new DiagramCanvas();
PathElement diagramElement = new PathElement();
diagramElement.Style.Fill = "green";
diagramElement.Data = "M150 0 L75 200 L225 200 Z";
container.Children.Add(diagramElement);
return container;
}
return null;
}
}
Constructors
PathElement()
Initializes a new instance of the PathElement class.
Declaration
public PathElement()
PathElement(PathElement)
Creates a new instance of the PathElement from the given PathElement.
Declaration
public PathElement(PathElement src)
Parameters
Type | Name | Description |
---|---|---|
PathElement | src | path element. |
Properties
AbsolutePath
Gets or sets the equivalent path, that will have the origin as 0,0.
Declaration
public string AbsolutePath { get; set; }
Property Value
Type | Description |
---|---|
System.String | The default value will be System.String.Empty |
Examples
<SfDiagramComponent SetNodeTemplate="SetTemplate">
</SfDiagramComponent>
@code
{
private CommonElement SetTemplate(IDiagramObject node)
{
if ((node as Node).ID == "node2")
{
DiagramCanvas container = new DiagramCanvas();
PathElement diagramElement = new PathElement();
diagramElement.AbsolutePath = "M150 0 L75 200 L225 200 Z";
container.Children.Add(diagramElement);
return container;
}
return null;
}
}
Data
Gets or sets the geometry of the path element.
Declaration
public string Data { get; set; }
Property Value
Type |
---|
System.String |
Examples
<SfDiagramComponent Width="1000px" Height="1000px" SetNodeTemplate="SetTemplate">
</SfDiagramComponent>
@code
{
private CommonElement SetTemplate(IDiagramObject node)
{
if ((node as Node).ID == "node2")
{
DiagramCanvas container = new DiagramCanvas();
PathElement diagramElement = new PathElement();
diagramElement.Data = "M150 0 L75 200 L225 200 Z";
container.Children.Add(diagramElement);
return container;
}
return null;
}
}
TransformPath
Gets or sets whether the path has to be transformed to fit the given x,y, width, height.
Declaration
public bool TransformPath { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true, The path has to be transformed to fit the given x,y,width, height.Otherwise, false. The default value is true. |
Examples
<SfDiagramComponent SetNodeTemplate="SetTemplate">
</SfDiagramComponent>
@code
{
private CommonElement SetTemplate(IDiagramObject node)
{
if ((node as Node).ID == "node2")
{
DiagramCanvas container = new DiagramCanvas();
PathElement diagramElement = new PathElement();
diagramElement.TransformPath = true;
container.Children.Add(diagramElement);
return container;
}
return null;
}
}
Methods
Clone()
Creates a new element that is a copy of the current path element
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | PathElement |