menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class StackPanel - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class StackPanel

    Represents a DiagramContainer that arranges child elements into a single line that can be oriented horizontally or vertically.

    Inheritance
    System.Object
    CommonElement
    DiagramElement
    DiagramContainer
    StackPanel
    Inherited Members
    CommonElement.ActualSize
    CommonElement.Bounds
    CommonElement.CornerRadius
    CommonElement.DesiredSize
    CommonElement.Flip
    CommonElement.FlipMode
    CommonElement.Height
    CommonElement.HorizontalAlignment
    CommonElement.ID
    CommonElement.IsDirt
    CommonElement.Margin
    CommonElement.MaxHeight
    CommonElement.MaxWidth
    CommonElement.MinHeight
    CommonElement.MinWidth
    CommonElement.OffsetX
    CommonElement.OffsetY
    CommonElement.OuterBounds
    CommonElement.ParentID
    CommonElement.Pivot
    CommonElement.RelativeMode
    CommonElement.RotationAngle
    CommonElement.Shadow
    CommonElement.Style
    CommonElement.VerticalAlignment
    CommonElement.Visible
    CommonElement.Width
    DiagramContainer.Children
    DiagramContainer.Padding
    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
    DiagramContainer.Clone()
    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.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved