Class LineRoutingSettings
Represents settings for customizing line routing behavior in the diagram component.
Inheritance
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class LineRoutingSettings : OwningComponentBase
Remarks
Supports various routing types including Classic and Advanced, and allows customization of obstacle padding.
Examples
Example usage:
<SfDiagramComponent>
<LineRoutingSettings RoutingType="RoutingTypes.Classic">
</LineRoutingSettings>
</SfDiagramComponent>
Constructors
LineRoutingSettings()
Declaration
public LineRoutingSettings()
Properties
ChildContent
Gets or sets the child content for configuring line routing settings in the diagram component.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
| Type |
|---|
| Microsoft.AspNetCore.Components.RenderFragment |
ObstaclePadding
Gets or sets the distance from an obstacle node to route the connector for advanced routing.
Declaration
public double ObstaclePadding { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | A System.Double value representing the padding distance in pixels. The default value is 12. |
Remarks
This property is only applicable when the RoutingType property is set to Advanced.
Examples
The following example demonstrates how to set the obstacle padding for advanced routing:
<SfDiagramComponent>
<LineRoutingSettings RoutingType="RoutingTypes.Advanced" ObstaclePadding="12">
</LineRoutingSettings>
</SfDiagramComponent>
ObstaclePaddingChanged
Specifies the callback to trigger when the Obstacle Padding changes.
Declaration
public EventCallback<double> ObstaclePaddingChanged { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.AspNetCore.Components.EventCallback<System.Double> | An Microsoft.AspNetCore.Components.EventCallback<> of type System.Double representing the new padding distance in pixels. Default value is 12. |
Remarks
The padding value determines the minimum distance maintained around obstacles during line routing calculations.
Examples
The following example demonstrates how to handle the obstacle padding change event:
<SfDiagramComponent>
<LineRoutingSettings RoutingType="RoutingTypes.Classic" ObstaclePaddingChanged="@OnObstaclePaddingChanged">
</LineRoutingSettings>
</SfDiagramComponent>
@code {
public void OnObstaclePaddingChanged(double args)
{
//Action to be performed
}
}
RoutingType
Gets or sets the type of line routing algorithm used in the diagram component for automatic connector routing.
Declaration
public RoutingTypes RoutingType { get; set; }
Property Value
| Type | Description |
|---|---|
| RoutingTypes | An enumeration value of RoutingTypes representing the type of line routing. The default value is Classic. |
Remarks
- Classic: Specifies the routing type as classic to produce a fast routing.
- Advanced: Defines the routing type as advanced to produce an accurate routing.
Examples
Setting routing type to Classic for better performance:
<SfDiagramComponent>
<LineRoutingSettings RoutingType="RoutingTypes.Classic">
</LineRoutingSettings>
</SfDiagramComponent>
RoutingTypeChanged
Gets or sets the callback event that is triggered when the routing type changes.
Declaration
public EventCallback<RoutingTypes> RoutingTypeChanged { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.AspNetCore.Components.EventCallback<RoutingTypes> | An Microsoft.AspNetCore.Components.EventCallback<> of type RoutingTypes that represents the callback function to execute when the routing type changes. |
Remarks
This callback is invoked whenever the RoutingType property is updated. The callback receives the new RoutingTypes value as a parameter.
Examples
The following example demonstrates how to handle the routing type change event:
<SfDiagramComponent>
<LineRoutingSettings RoutingType="RoutingTypes.Classic" RoutingTypeChanged="@OnRoutingTypeChanged">
</LineRoutingSettings>
</SfDiagramComponent>
@code {
public void OnRoutingTypeChanged(RoutingTypes args)
{
//Action to be performed
}
}
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Dispose()
Releases all resources used by the LineRoutingSettings component.
Declaration
public void Dispose()
OnAfterRenderAsync(Boolean)
Method invoked after each time the component has been rendered.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | firstRender | Set to true for the first time component rendering; otherwise gets false. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
Remarks
Handles post-render operations by updating parent component's line routing settings.
OnInitializedAsync()
Asynchronously initializes the LineRoutingSettings component when it's ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous initialization operation. |
Remarks
Runs automatically when the component starts up. Sets up the component and tells the parent component about this instance.