Skip to content

TextAlignment

Summary

The text alignment regarding the anchor point.

Signature

1
public enum TextAlignment

Namespace

cAlgo.API

Fields

Name Description
Left Align the text left.
Right Align the text right.
Center Center the text vertically.
Justify Justify the text.

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 use TextAlignment property to align the text
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class TextAlignmentSample : Indicator
     {
         [Parameter("Text Alignment", DefaultValue = TextAlignment.Center)]
         public TextAlignment TextAlignment { 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 = "Sample text", TextAlignment = TextAlignment });
             Chart.AddControl(stackPanel);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

Last update: March 23, 2023