Class SnapSettings
Customizes and controls the grid lines and the snap behavior of the diagram.
Inheritance
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class SnapSettings : OwningComponentBase
Examples
<SfDiagramComponent>
// Shows the horizontal grid lines
<SnapSettings Constraints ="SnapConstraints.ShowLines" SnapAngle="10">
<HorizontalGridLines LineColor = "blue" LineDashArray="2,2">
</HorizontalGridLines>
<VerticalGridLines LineColor = "blue" LineDashArray="2,2">
</VerticalGridLines>
</SnapSettings>
</SfDiagramComponent>
Constructors
SnapSettings()
Declaration
public SnapSettings()
Properties
ChildContent
Gets or sets the child content of the SnapSettings.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.RenderFragment |
Constraints
Enables or disables the features of grid lines and SnapSettings.
Declaration
public SnapConstraints Constraints { get; set; }
Property Value
Type | Description |
---|---|
SnapConstraints | The default value will be All. |
Examples
<SfDiagramComponent>
<SnapSettings Constraints ="SnapConstraints.ShowLines" >
</SnapSettings>
</SfDiagramComponent>
ConstraintsChanged
Specifies the callback to trigger when the constraints changes.
Declaration
public EventCallback<SnapConstraints> ConstraintsChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<SnapConstraints> |
GridType
Defines the diagram Grid pattern.
Declaration
public GridType GridType { get; set; }
Property Value
Type | Description |
---|---|
GridType | The default value will be Lines. |
Remarks
The GridType can be set to lines or dots. By default, the GridType is set to lines.
Examples
<SfDiagramComponent>
<SnapSetting GridType = GridType.Lines >
</SnapSettings>
</SfDiagramComponent>
GridTypeChanged
Specifies the callback to trigger when the GridType changes.
Declaration
public EventCallback<GridType> GridTypeChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<GridType> |
HorizontalGridLines
Defines the pattern of horizontal grid lines
Declaration
public HorizontalGridLines HorizontalGridLines { get; set; }
Property Value
Type |
---|
HorizontalGridLines |
Examples
<SfDiagramComponent>
<SnapSettings >
<HorizontalGridLines LineColor = "blue" LineDashArray="2,2">
</HorizontalGridLines>
</SnapSettings>
</SfDiagramComponent>
SnapAngle
SnapAngle defines the angle by which the object needs to be rotated. By default, 5.
Declaration
public double SnapAngle { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default snape angle value is 5. |
Examples
<SfDiagramComponent>
<SnapSettings SnapAngle="10">
</VerticalGridLines>
</SnapSettings>
</SfDiagramComponent>
SnapAngleChanged
Specifies the callback to trigger when the SnaAngle changes.
Declaration
public EventCallback<double> SnapAngleChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Double> |
SnapDistance
Defines the minimum distance between the selected object and the nearest object. By default, it is 5.
Declaration
public double SnapDistance { get; set; }
Property Value
Type |
---|
System.Double |
Examples
<SfDiagramComponent>
<SnapSettings SnapDistance="10">
</SnapSettings>
</SfDiagramComponent>
SnapDistanceChanged
Specifies the callback to trigger when the SnapObjectDistance changes.
Declaration
public EventCallback<double> SnapDistanceChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Double> |
SnapLineStyle
Gets or sets the style of the snapping lines used to indicate alignment when moving or resizing elements.
Declaration
public ShapeStyle SnapLineStyle { get; set; }
Property Value
Type | Description |
---|---|
ShapeStyle | The shape style defining the appearance of snapping lines. |
Remarks
Snapping lines assist users in aligning elements precisely during movement or resizing operations. By setting this property, users can customize the appearance of these snapping lines to enhance visibility or match specific aesthetic preferences.
Examples
<SfDiagramComponent>
<SnapSettings SnapLineStyle ="snapLineStyle" >
</SnapSettings>
</SfDiagramComponent>
@code{
ShapeStyle snapLineStyle = new ShapeStyle() { StrokeColor = "green" };
}
VerticalGridLines
Defines the pattern of vertical grid lines.
Declaration
public VerticalGridLines VerticalGridLines { get; set; }
Property Value
Type |
---|
VerticalGridLines |
Examples
<SfDiagramComponent>
<SnapSettings >
<VerticalGridLines LineColor = "blue" LineDashArray="2,2">
</VerticalGridLines>
</SnapSettings>
</SfDiagramComponent>
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Dispose()
This method releases all unmanaged resources.
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. |
OnInitializedAsync()
Method invoked when the component is ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
OnParametersSetAsync()
Method invoked when any changes in component state occur.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | ="Task". |