Skip to content

StackPanel

class cAlgo.API

DesktopCLICloud

Arranges the child element into a single line that can be oriented horizontally or vertically.

Environment behaviour

CLI — not supported. Accepted without error but never displayed, so control events such as Click are never raised.

Cloud — not supported. Accepted without error but never displayed, so control events such as Click are never raised.

Definition

public class StackPanel : Panel

Namespace: cAlgo.API · Group: Layout · Inherits: Panel, ControlBase

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use the StackPanel
    public partial class StackPanelSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                BackgroundColor = Color.Gold,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Orientation = PanelOrientation
            };

            for (int i = 0; i < 10; i++)
            {
                stackPanel.AddChild(new TextBlock
                {
                    Text = "Text",
                    Margin = 5,
                    ForegroundColor = Color.Black,
                    FontWeight = FontWeight.ExtraBold
                });
            }

            Chart.AddControl(stackPanel);
        }

        public override void Calculate(int index)
        {
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        stackPanel = StackPanel()
        stackPanel.BackgroundColor = Color.Gold
        stackPanel.HorizontalAlignment = HorizontalAlignment.Center
        stackPanel.VerticalAlignment = VerticalAlignment.Center
        stackPanel.Orientation = api.PanelOrientation

        for i in range(10):
            textBlock = TextBlock()
            textBlock.Text = "Text"
            textBlock.Margin = Thickness(5)
            textBlock.ForegroundColor = Color.Black
            textBlock.FontWeight = FontWeight.ExtraBold

            stackPanel.AddChild(textBlock)

        api.Chart.AddControl(stackPanel)
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "Parameters": [
    {
      "Name": "PanelOrientation",
      "DisplayName": "Panel Orientation",
      "Type": "Enum",
      "EnumTypeFullName": "cAlgo.API.Orientation",
      "DefaultValue": "Vertical"
    }
  ]
}

Constructors

Name Description
StackPanelDesktopCLICloud Initializes a new instance of the StackPanel class.

Properties

Name Description
OrientationDesktopCLICloudOrientation Gets or sets the StackPanel orientation.

Inherited members

From Panel: AddChild, RemoveChild, HasChild, BackgroundColor, Children, ChildCount

From ControlBase: ResetProperty, UniqueId, Style, Left, Top, Right, Bottom, Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight, IsEnabled, IsVisible, Opacity, Margin, VerticalAlignment, HorizontalAlignment, Dock, IsHitTestVisible