Class DiagramSelectionSettings
Represents a visual representation of the selected elements. Provides functionality as a container for single or multiple selected elements in a diagram structure.
Inheritance
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class DiagramSelectionSettings : Object, IDiagramObject, ICloneable
Remarks
This class facilitates the manipulation and organization of selected elements within a diagram.
Constructors
DiagramSelectionSettings()
Initializes a new instance of the DiagramSelectionSettings.
Declaration
public DiagramSelectionSettings()
DiagramSelectionSettings(DiagramSelectionSettings)
Creates a new instance of DiagramSelectionSettings from an existing instance.
Declaration
public DiagramSelectionSettings(DiagramSelectionSettings src)
Parameters
Type | Name | Description |
---|---|---|
DiagramSelectionSettings | src | The source DiagramSelectionSettings to clone. |
Properties
CanToggleSelection
Gets or sets a value indicating whether the selection state of the diagram elements should be toggled based on user selection at runtime.
Declaration
public bool CanToggleSelection { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A System.Boolean indicating whether diagram elements can have their selection state toggled. The default value is false. |
Remarks
This property allows users to toggle the selection of diagram elements during runtime, enhancing user interaction with the diagram. When set to true, users can click to select or deselect elements, which can be useful in scenarios where multi-element manipulation is required.
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@selectionSettings" Height="600px" Nodes="@nodes" />
@code {
SfDiagramComponent diagram;
// Initialize the node collection
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
DiagramSelectionSettings selectionSettings = new DiagramSelectionSettings() { CanToggleSelection = true };
protected override void OnInitialized() {
Node node = new Node() {
ID = "node1",
// Size of the node
Height = 100,
Width = 100,
// Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
}
}
Connectors
Gets or sets the collection of selected connectors in the diagram.
Declaration
public ObservableCollection<Connector> Connectors { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<Connector> | An System.Collections.ObjectModel.ObservableCollection<> representing the selected connectors. The default value is an empty collection. |
Remarks
This property contains the connectors that are currently selected within the diagram component.
Examples
<SfDiagramComponent ref="@diagram" Height="600px" Connectors="@nodes" />
@code {
SfDiagramComponent diagram;
DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
protected override void OnInitialized() {
Connector connector = new Connector() {
ID = "connector1",
Type = ConnectorSegmentType.Straight,
SourcePoint = new DiagramPoint() { X = 100, Y = 100 },
TargetPoint = new DiagramPoint() { X = 200, Y = 200 },
};
connectors.Add(connector);
diagram.SelectionSettings.Connectors[0].Constraints |= ConnectorConstraints.Delete;
}
}
Constraints
Gets or sets the constraints that enable or disable certain behaviors of the selector.
Declaration
public SelectorConstraints Constraints { get; set; }
Property Value
Type | Description |
---|---|
SelectorConstraints | A SelectorConstraints specifying the constraints applied to the selector. The default value is All. |
Remarks
This property allows fine-grained control over the selector's behavior, enabling configurations such as moving, resizing, and rotating components within the diagram.
Examples
<SfDiagramComponent ref="@diagram" Height="600px" Connectors="@connectors" />
@code {
private SfDiagramComponent diagram;
// Initialize the node collection with connectors
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
protected override void OnInitialized() {
Connector connector = new Connector() {
ID = "connector1",
Type = ConnectorSegmentType.Straight,
SourcePoint = new DiagramPoint() { X = 100, Y = 100 },
TargetPoint = new DiagramPoint() { X = 200, Y = 200 },
Constraints = ConnectorConstraints.Default & ~ConnectorConstraints.Select
};
connectors.Add(connector);
diagram.SelectionSettings.Connectors[0].Constraints |= ConnectorConstraints.Delete;
}
}
Header
Gets or sets the header associated with the selected lane or phase element.
Declaration
public SwimlaneHeader Header { get; set; }
Property Value
Type | Description |
---|---|
SwimlaneHeader | The header of the selected lane or phase, represented by a SwimlaneHeader object. The default value is null. |
Remarks
This property allows you to specify or retrieve the header information for particular lanes or phases within a diagram.
Height
Gets or sets the height of the selected region within the diagram.
Declaration
public double Height { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the height in pixels. The default value is |
Remarks
This property is crucial for defining the dimension of the selected area, determining its vertical size within the diagram.
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@select" Height="600px" Nodes="@nodes" />
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
//Size of the node
Height = 100,
Width = 100,
//Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
DiagramSelectionSettings select = new DiagramSelectionSettings() { Width =100, Height=150 };
}
}
Lanes
Represents the collection of selected lanes within the diagram.
Declaration
public ObservableCollection<Lane> Lanes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<Lane> | An System.Collections.ObjectModel.ObservableCollection<> consisting of Lane objects. The default value is an empty collection. |
Remarks
This property is used for querying and updating the state of lanes that are selected in the diagram.
Nodes
Gets or sets a collection of selected nodes within the diagram.
Declaration
public ObservableCollection<Node> Nodes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<Node> | An System.Collections.ObjectModel.ObservableCollection<> instance representing the selected nodes. The default value is an empty collection. |
Remarks
This property is used to access or manipulate the nodes selected in the diagram component.
Examples
<SfDiagramComponent ref="@diagram" Height="600px" Nodes="@nodes" />
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
// Size of the node
Height = 100,
Width = 100,
// Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
diagram.SelectionSettings.Nodes[0].Constraints |= NodeConstraints.AspectRatio;
}
}
OffsetX
Gets or sets the X-coordinate of the selected region. It represents the horizontal offset of the selection.
Declaration
public double OffsetX { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the X-coordinate of the selected region. |
Remarks
This property is crucial for positioning and aligning elements within the diagram.
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@select" Height="600px" Nodes="@nodes" />
@code {
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
// Size of the node
Height = 100,
Width = 100,
// Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
DiagramSelectionSettings select = new DiagramSelectionSettings() {OffsetX = 100, Width =100, Height=150 };
}
}
OffsetY
Gets or sets the Y-coordinate of the selected region.
Declaration
public double OffsetY { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double that represents the Y-coordinate. The default value is |
Remarks
This property is essential for defining the vertical position of a selected region within the diagram.
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@select" Height="600px" Nodes="@nodes" />
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
//Size of the node
Height = 100,
Width = 100,
//Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
DiagramSelectionSettings select = new DiagramSelectionSettings() {OffsetY = 100, OffsetX = 100, Width = 100, Height = 150 };
}
}
Phases
Represents the collection of selected phases within the diagram.
Declaration
public ObservableCollection<Phase> Phases { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<Phase> | An System.Collections.ObjectModel.ObservableCollection<> comprising Phase objects. The default value is an empty collection. |
Remarks
This property supports operations involving multiple selected phases, facilitating their management within the diagram.
Pivot
Gets or sets the DiagramPoint that defines the ratio or fractional value relative to the node.
Declaration
public DiagramPoint Pivot { get; set; }
Property Value
Type | Description |
---|---|
DiagramPoint | A DiagramPoint representing the pivot point of the node. The default value is
|
Remarks
This property is critical in determining the node's transformation behaviors. By adjusting the Pivot value, you can control how a node scales or rotates in the diagram.
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@select" Height="600px" Nodes="@nodes" />
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
//Size of the node
Height = 100,
Width = 100,
//Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
DiagramSelectionSettings select = new DiagramSelectionSettings() { Pivot = new DiagramPoint() { X = 0.5, Y = 0.5 }, Width = 100, Height = 150 };
}
}
RotationAngle
Gets or sets the angle at which the Node should be rotated.
Declaration
public double RotationAngle { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the rotation angle in degrees. The default value is |
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@select" Height="600px" Nodes="@nodes" />
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
// Size of the node
Height = 100,
Width = 100,
// Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
DiagramSelectionSettings select = new DiagramSelectionSettings()
{
RotationAngle = 60,
OffsetY = 100,
OffsetX = 100,
Width = 100,
Height = 150
};
}
}
RubberBandSelectionMode
Gets or sets the behavior that determines whether diagram objects can be selected when the selection region intersects with the objects.
Declaration
public RubberBandSelectionMode RubberBandSelectionMode { get; set; }
Property Value
Type | Description |
---|---|
RubberBandSelectionMode | A RubberBandSelectionMode indicating the selection mode behavior. The default value is CompleteIntersect. |
Remarks
This property determines how selection is applied when using the rubber band selection tool.
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@select" Height="600px" Nodes="@nodes" />
@code
{
SfDiagramComponent diagram;
// Initialize the node collection with node and with Expand & CollapseIcon
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
DiagramObjectCollection<UserHandle> handles = new DiagramObjectCollection<UserHandle>()
{
new UserHandle()
{
Name = "handle1",
PathData = "M10.13,0 L1.45,0 C0.66,0,0,0.55,0,1.26 L0,10 L1.45,10 L1.45,1.26 L10.1,1.26 L10.1,0 Z M12.3,2.49 L4.36,2.49 C3.57,2.49,2.91,3.04,2.91,3.75 L2.91,12.49 C2.91,13.18,3.54,13.75,4.36,13.75 L12.3,13.75 C13.09,13.75,13.75,13.2,13.75,12.49 L13.75,3.75 C13.72,3.07,13.09,2.49,12.3,2.49 Z M12.3,12.47 L4.36,12.47 L4.36,3.75 L12.3,3.75 L12.3,12.47 Z"
}
};
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
// Size of the node
Height = 100,
Width = 100,
// Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
DiagramSelectionSettings select = new DiagramSelectionSettings() { RubberBandSelectionMode = RubberBandSelectionMode.CompleteIntersect };
}
}
Swimlanes
Represents the collection of selected swimlanes within the diagram.
Declaration
public ObservableCollection<Swimlane> Swimlanes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<Swimlane> | An System.Collections.ObjectModel.ObservableCollection<> consisting of Swimlane objects. The default value is an empty collection. |
Remarks
This property is useful for handling and manipulating multiple swimlanes that are selected at once within the diagram.
UserHandles
Gets or sets the collection of UserHandles associated with the diagram.
Declaration
public DiagramObjectCollection<UserHandle> UserHandles { get; set; }
Property Value
Type | Description |
---|---|
DiagramObjectCollection<UserHandle> | A DiagramObjectCollection<T> of UserHandle objects. The default value is null. |
Remarks
This property is useful for adding, customizing, and manipulating user-defined handles on diagram nodes within the diagram interface.
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@select" Height="600px" Nodes="@nodes" />
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
DiagramObjectCollection<UserHandle> handles = new DiagramObjectCollection<UserHandle>()
{
new UserHandle(){ Name= "handle1", PathData= "M10.13,0 L1.45,0 C0.66,0,0,0.55,0,1.26 L0,10 L1.45,10 L1.45,1.26 L10.1,1.26 L10.1,0 Z M12.3,2.49 L4.36,2.49 C3.57,2.49,2.91,3.04,2.91,3.75 L2.91,12.49 C2.91,13.18,3.54,13.75,4.36,13.75 L12.3,13.75 C13.09,13.75,13.75,13.2,13.75,12.49 L13.75,3.75 C13.72,3.07,13.09,2.49,12.3,2.49 Z M12.3,12.47 L4.36,12.47 L4.36,3.75 L12.3,3.75 L12.3,12.47 Z"}
};
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
Height = 100,
Width = 100,
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
DiagramSelectionSettings select = new DiagramSelectionSettings() { UserHandles = handles };
}
}
Width
Gets or sets the width of the selection region.
Declaration
public double Width { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the width of the selection region. The default value is |
Remarks
The width of the selection region is crucial for rendering the selection box and is dynamically updated based on user interactions or code changes that influence the selection region size.
Examples
<SfDiagramComponent ref="@diagram" SelectionSettings="@select" Height="600px" Nodes="@nodes" />
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node = new Node()
{
ID = "node1",
// Size of the node
Height = 100,
Width = 100,
// Position of the node
OffsetX = 100,
OffsetY = 100,
};
nodes.Add(node);
DiagramSelectionSettings select = new DiagramSelectionSettings() { Width = 100, Height = 150 };
}
}
Methods
Clone()
Creates a new instance of DiagramSelectionSettings that is a copy of the current selector.
Declaration
public virtual object Clone()
Returns
Type | Description |
---|---|
System.Object | A new DiagramSelectionSettings object which is a copy of the current selector. |
OnPropertyChanged(String, Object, Object, IDiagramObject)
Invoked when the effective value of any property on this selector has been updated.
Declaration
public void OnPropertyChanged(string propertyName, object newVal, object oldVal, IDiagramObject container)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | string that contains the propertyname. |
System.Object | newVal | An object that contain newvalue, which means new value of property |
System.Object | oldVal | An object that contain oldvalue, which means old value of property |
IDiagramObject | container | An IPaletteObject that contain IDiagramObject |