Skip to content

Style

class cAlgo.API

DesktopCLICloud

Represents the style of a chart control.

Definition

public class Style

Namespace: cAlgo.API · Group: Styles

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use control style to change a group of controls style instead of setting each control properties separatly
    public partial class StyleSample : Indicator
    {
        protected override void Initialize()
        {
            var style = new Style();

            style.Set(ControlProperty.Margin, 5);
            style.Set(ControlProperty.ForegroundColor, Color.Blue);
            style.Set(ControlProperty.FontSize, 14);
            style.Set(ControlProperty.Width, 100);

            var stackPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold,
                Orientation = Orientation.Vertical
            };

            for (var i = 0; i < 10; i++)
            {
                stackPanel.AddChild(new TextBlock
                {
                    Text = "Text Block #" + i,
                    Style = style
                });
            }

            Chart.AddControl(stackPanel);
        }

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

from cAlgo.API import *

class Test():
    def initialize(self):
        style = Style()
        style.Set(ControlProperty.Margin, 5)
        style.Set(ControlProperty.ForegroundColor, Color.Blue)
        style.Set(ControlProperty.FontSize, 14)
        style.Set(ControlProperty.Width, 100)

        stackPanel = StackPanel()
        stackPanel.HorizontalAlignment = HorizontalAlignment.Center
        stackPanel.VerticalAlignment = VerticalAlignment.Center
        stackPanel.BackgroundColor = Color.Gold
        stackPanel.Orientation = Orientation.Vertical

        for i in range(10):
            textBlock = TextBlock()
            textBlock.Text = f"Text Block #{i}"
            textBlock.Style = style
            stackPanel.AddChild(textBlock)

        api.Chart.AddControl(stackPanel)
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}

Constructors

Name Description
Style 2 overloadsDesktopCLICloud Initializes a new instance of Style class.

Methods

Name Description
Get 2 overloadsDesktopCLICloudobject Gets the chart object style for the specified ControlProperty.
Set 2 overloadsDesktopCLICloudvoid Provides data for the chart control Style for the specified ControlProperty and the ControlState.