Skip to content

TextBlock

Summary

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

Signature

1
public class TextBlock : Control

Namespace

cAlgo.API

Properties

Name Description
Text { get; set; } Gets or sets the text.
TextAlignment { get; set; } Gets or sets the text alignment.
LineHeight { get; set; } Gets or sets the height of the line.
LineStackingStrategy { get; set; } Gets or sets the mechanism by which a line box is determined for each line of text within the TextBlock.
TextWrapping { get; set; } Gets or sets the way how the TextBlock should wrap the text.
TextTrimming { get; set; } Gets or sets the text trimming behavior when the content overflows the content area.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample indicator shows how to add a text block control on your chart
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class TextBlockSample : Indicator
     {
         [Parameter("Text", DefaultValue = "Sample text")]
         public string Text { get; set; }
         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)
         {
         }
     }
 }

See Also


Last update: July 1, 2022

Comments