Skip to content

TextTrimming

Summary

Describes how text is trimmed when it overflows the edge of its containing box.

Signature

1
public enum TextTrimming

Namespace

cAlgo.API

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
28
29
30
31
32
33
34
35
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample indicator shows how to use TextTrimming property to manage the text trim
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class TextTrimmingSample : Indicator
     {
         [Parameter("Text", DefaultValue = "very long texttttttttttttttttttttt")]
         public string Text { get; set; }
         [Parameter("Trimming", DefaultValue = TextTrimming.CharacterEllipsis)]
         public TextTrimming TextTrimming { get; set; }
         protected override void Initialize()
         {
             var stackPanel = new StackPanel
             {
                 BackgroundColor = Color.Gold,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 Opacity = 0.6,
                 Width = 100
             };
             stackPanel.AddChild(new TextBlock
             {
                 Text = Text,
                 FontWeight = FontWeight.ExtraBold,
                 ForegroundColor = Color.Blue,
                 TextTrimming = TextTrimming
             });
             Chart.AddControl(stackPanel);
         }
         public override void Calculate(int index)
         {
         }
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 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 = 100
         textBlock = TextBlock()
         # Text is a parameter of type string
         # defined in indicator C# file
         textBlock.Text = api.Text
         # TextTrimming is a parameter of type TextTrimming
         # defined in indicator C# file
         textBlock.TextTrimming = api.TextTrimming
         textBlock.FontWeight = FontWeight.ExtraBold
         textBlock.ForegroundColor = Color.Blue
         stackPanel.AddChild(textBlock)
         api.Chart.AddControl(stackPanel)

Fields

None

Summary

Text is not trimmed.

Signature

1
TextTrimming.None;

Return Value

TextTrimming

CharacterEllipsis

Summary

Text is trimmed at a character boundary. An ellipsis (...) is drawn in place of remaining text.

Signature

1
TextTrimming.CharacterEllipsis;

Return Value

TextTrimming

WordEllipsis

Summary

Text is trimmed at a word boundary. An ellipsis (...) is drawn in place of remaining text.

Signature

1
TextTrimming.WordEllipsis;

Return Value

TextTrimming