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

Fields

Name Description
None Text is not trimmed.
CharacterEllipsis Text is trimmed at a character boundary. An ellipsis (...) is drawn in place of remaining text.
WordEllipsis Text is trimmed at a word boundary. An ellipsis (...) is drawn in place of remaining 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
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)
         {
         }
     }
 }

Last update: July 1, 2022

Comments