Skip to content

TextWrapping

enum cAlgo.API

DesktopCLICloud

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

Definition

public enum TextWrapping

Namespace: cAlgo.API · Group: Controls

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to use TextWrapping property to manage the text wrap
    public partial class TextWrappingSample : Indicator
    {
        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)
        {
        }
    }
}
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()
        textBlock.Text = api.Text
        textBlock.TextWrapping = api.TextWrapping
        textBlock.FontWeight = FontWeight.ExtraBold
        textBlock.ForegroundColor = Color.Blue

        stackPanel.AddChild(textBlock)

        api.Chart.AddControl(stackPanel)
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "Parameters": [
    {
      "Name": "Text",
      "Type": "String",
      "DefaultValue": "very long texttttttttttttttttttttt"
    },
    {
      "Name": "TextWrapping",
      "DisplayName": "Wrapping",
      "Type": "Enum",
      "EnumTypeFullName": "cAlgo.API.TextWrapping",
      "DefaultValue": "NoWrap"
    }
  ]
}

Values

Name Value Description
WrapWithOverflow 0 Line-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.
NoWrap 1 No line wrapping is performed.
Wrap 2 Line-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.