Class StackPanel
Represents a DiagramContainer that arranges child elements into a single line that can be oriented horizontally or vertically.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class StackPanel : DiagramContainer
Remarks
The StackPanel arranges child elements sequentially in a single line, either horizontally or vertically.
Constructors
StackPanel()
Initializes a new instance of the StackPanel class.
Declaration
public StackPanel()
Remarks
Creates a new StackPanel with default vertical orientation.
StackPanel(StackPanel)
Initializes a new instance of the StackPanel class by copying properties from an existing StackPanel instance.
Declaration
public StackPanel(StackPanel src)
Parameters
Type | Name | Description |
---|---|---|
StackPanel | src | The source StackPanel instance to copy properties from. If null, only the base class initialization is performed. |
Remarks
This copy constructor creates a new StackPanel with the same configuration as the source panel, including Orientation and padding settings.
Properties
Orientation
Gets or sets a value that indicates the dimension by which child elements are stacked in the StackPanel.
Declaration
public Orientation Orientation { get; set; }
Property Value
Type | Description |
---|---|
Orientation | An Orientation value specifying the stacking direction for child elements. The default value is Vertical. |
Remarks
When set to Vertical, child elements are stacked in a column layout. When set to Horizontal, elements are arranged in a row layout.
Examples
This example demonstrates how to set the orientation of a StackPanel in a diagram component.
<SfDiagramComponent @bind-Nodes="Nodes" SetNodeTemplate="SetTemplate">
</SfDiagramComponent>
@code
{
DiagramObjectCollection<Node> Nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
StackPanel stackPanel = SetTemplate(null) as StackPanel;
stackPanel.Orientation = Orientation.Horizontal;
basicElements.Add(stackPanel);
}
}
Methods
Clone()
Creates a new element that is a copy of the current StackPanel instance.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A new StackPanel object that is a deep copy of the current instance, including all properties and configuration settings but excluding parent-child relationships. |
Overrides
Remarks
Performs a deep copy preserving all properties and configurations. The cloned instance excludes parent-child relationships.
StretchChildren(DiagramSize)
Stretches the child elements based on the size of the panel.
Declaration
protected void StretchChildren(DiagramSize size)
Parameters
Type | Name | Description |
---|---|---|
DiagramSize | size | DiagramSize. |