Skip to content

TextBlock

class cAlgo.API

DesktopCLICloud

Represents the Text Block - the control to display a non-interactive text.

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 TextBlock : Control

Namespace: cAlgo.API · Group: Controls · Inherits: Control, ControlBase

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to add a text block control on your chart
    public partial class TextBlockSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                BackgroundColor = Color.Gold,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Opacity = 0.6,
                Width = 200
            };

            stackPanel.AddChild(new TextBlock { Text = Text, FontWeight = FontWeight.ExtraBold, ForegroundColor = Color.Blue });

            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.Opacity = 0.6
        stackPanel.Width = 200

        textBlock = TextBlock()
        textBlock.Text = api.Text
        textBlock.FontWeight = FontWeight.ExtraBold
        textBlock.ForegroundColor = Color.Blue

        stackPanel.AddChild(textBlock)

        api.Chart.AddControl(stackPanel)
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "Parameters": [
    {
      "Name": "Text",
      "Type": "String",
      "DefaultValue": "Sample text"
    }
  ]
}

Constructors

Name Description
TextBlockDesktopCLICloud Initializes a new instance of the Text Block class.

Properties

Name Description
LineHeightDesktopCLIClouddouble Gets or sets the height of the line.
LineStackingStrategyDesktopCLICloudLineStackingStrategy Gets or sets the mechanism by which a line box is determined for each line of text within the TextBlock.
TextDesktopCLICloudstring Gets or sets the text.
TextAlignmentDesktopCLICloudTextAlignment Gets or sets the text alignment.
TextTrimmingDesktopCLICloudTextTrimming Gets or sets the text trimming behavior when the content overflows the content area.
TextWrappingDesktopCLICloudTextWrapping Gets or sets the way how the TextBlock should wrap the text.

Inherited members

From Control: ForegroundColor, BackgroundColor, Padding, VerticalContentAlignment, HorizontalContentAlignment, FontWeight, FontStyle, FontFamily, FontSize

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

See also