StackPanel


Summary

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

Syntax

public class StackPanel : Panel

Members

NameTypeSummary
Orientation PropertyGets or sets the StackPanel orientation.
StackPanel MethodInitializes a new instance of the StackPanel class.

Example 1

using cAlgo.API;
namespace cAlgo
{
    // This sample shows how to use the StackPanel
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class StackPanelSample : Indicator
    {
        [Parameter("Panel Orientation", DefaultValue = Orientation.Vertical)]
        public Orientation PanelOrientation { get; set; }
        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)
        {
        }
    }
}
Reference