TextWrapping


Summary

Specifies whether text wraps when it reaches the edge of the containing box.

Syntax

public sealed enum TextWrapping

Members

NameTypeSummary
NoWrap FieldNo line wrapping is performed.
Wrap FieldLine-breaking occurs if the line overflows beyond the available block width, even if the standard line breaking algorithm cannot determine any line break opportunity, as in the case of a very long word constrained in a fixed-width container with no scrolling allowed.
WrapWithOverflow FieldLine-breaking occurs if the line overflows beyond the available block width. However, a line may overflow beyond the block width if the line breaking algorithm cannot determine a line break opportunity, as in the case of a very long word constrained in a fixed-width container with no scrolling allowed.

Example 1

using cAlgo.API;
namespace cAlgo
{
    // This sample indicator shows how to use TextWrapping property to manage the text wrap
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TextWrappingSample : Indicator
    {
        [Parameter("Text", DefaultValue = "very long texttttttttttttttttttttt")]
        public string Text { get; set; }
        [Parameter("Wrapping", DefaultValue = TextWrapping.NoWrap)]
        public TextWrapping TextWrapping { 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,
                TextWrapping = TextWrapping
            });
            Chart.AddControl(stackPanel);
        }
        public override void Calculate(int index)
        {
        }
    }
}
Reference