TextTrimming


Summary

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

Syntax

public sealed enum TextTrimming

Members

NameTypeSummary
CharacterEllipsis FieldText is trimmed at a character boundary. An ellipsis (...) is drawn in place of remaining text.
None FieldText is not trimmed.
WordEllipsis FieldText is trimmed at a word boundary. An ellipsis (...) is drawn in place of remaining text.

Example 1

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)
        {
        }
    }
}
Reference