menu

ASP.NET MVC

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TextBlock

    Show / Hide Table of Contents

    Class TextBlock

    Defines the textBlock object that is used to define the text to be added and customize the appearance of that text.

    Inheritance
    System.Object
    EJTagHelper
    TextBlock
    Label
    Inherited Members
    EJTagHelper.GetControlDetails()
    EJTagHelper.GetControlDetails(String)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.JavaScript.DataVisualization.Models.Diagram
    Assembly: Syncfusion.EJ.dll
    Syntax
    public class TextBlock : EJTagHelper

    Constructors

    TextBlock()

    Declaration
    public TextBlock()

    Properties

    Alignment

    Declaration
    [JsonProperty("alignment")]
    [JsonConverter(typeof(StringEnumConverter))]
    public LabelAlignment Alignment { get; set; }
    Property Value
    Type Description
    LabelAlignment

    Bold

    Gets or sets the bold style

    Declaration
    [JsonProperty("bold")]
    public bool Bold { get; set; }
    Property Value
    Type Description
    System.Boolean

    false

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Bold = true });
               Model.Nodes.Add(Node);

    BoundaryConstraints

    Declaration
    [JsonProperty("boundaryConstraints")]
    public bool BoundaryConstraints { get; set; }
    Property Value
    Type Description
    System.Boolean

    FontColor

    Gets or sets the font color of the text

    Declaration
    [JsonProperty("fontColor")]
    public string FontColor { get; set; }
    Property Value
    Type Description
    System.String

    "black"

    Examples
                Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", FontColor = "red" });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    FontFamily

    Gets or sets the font family of the text

    Declaration
    [JsonProperty("fontFamily")]
    public string FontFamily { get; set; }
    Property Value
    Type Description
    System.String

    "Arial"

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", FontFamily = "seugoe UI" });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    FontSize

    Gets or sets the font size of the text

    Declaration
    [JsonProperty("fontSize")]
    public int FontSize { get; set; }
    Property Value
    Type Description
    System.Int32

    12

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", FontSize = 14 });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    HorizontalAlignment

    Gets or sets the horizontal alignment of the label

    Declaration
    [JsonProperty("horizontalAlignment")]
    [JsonConverter(typeof(StringEnumConverter))]
    public HorizontalAlignment HorizontalAlignment { get; set; }
    Property Value
    Type Description
    HorizontalAlignment

    HorizontalAlignment.Center

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", HorizontalAlignment = HorizontalAlignment.Right });
               Node.Labels = Labels;

    Italic

    Gets or sets the italic style

    Declaration
    [JsonProperty("italic")]
    public bool Italic { get; set; }
    Property Value
    Type Description
    System.Boolean

    false

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Italic = true });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    Margin

    Gets or sets the margin of the label

    Declaration
    [JsonProperty("margin")]
    public LabelMargin Margin { get; set; }
    Property Value
    Type Description
    LabelMargin

    Margin()

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Italic = true, Margin = new LabelMargin() { Left = 5 } });
               Node.Labels = Labels;

    Mode

    Gets or sets whether the label is currently being edited or not

    Declaration
    [JsonConverter(typeof(StringEnumConverter))]
    [JsonProperty("mode")]
    public LabelEditMode Mode { get; set; }
    Property Value
    Type Description
    LabelEditMode

    LabelEditMode.Edit

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Mode = LabelEditMode.Edit });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    Offset

    Gets or sets the fraction/ratio(relative to node) that defines the position of the label

    Declaration
    [JsonProperty("offset")]
    public DiagramPoint Offset { get; set; }
    Property Value
    Type Description
    DiagramPoint

    Point(0.5, 0.5)

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", Offset = new DiagramPoint() { X = 0, Y = .5 } });
               node.Labels = Labels;
               Model.Nodes.Add(Node);

    Opacity

    Gets or sets the opacity of the label

    Declaration
    [JsonProperty("opacity")]
    public double Opacity { get; set; }
    Property Value
    Type Description
    System.Double

    1

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", opacity = 0.5 });
               Node.Labels = Labels;

    OverflowType

    Gets or sets the text overflow type

    Declaration
    [JsonConverter(typeof(StringEnumConverter))]
    [JsonProperty("overflowType")]
    public OverflowType OverflowType { get; set; }
    Property Value
    Type Description
    OverflowType

    OverflowType.Ellipsis

    Examples
                Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1",TextOverflow = true, OverflowType = OverflowType.Ellipsis });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    Padding

    Declaration
    [JsonProperty("padding")]
    public Padding Padding { get; set; }
    Property Value
    Type Description
    Padding

    ReadOnly

    Gets or sets whether the label is editable or not

    Declaration
    [JsonProperty("readOnly")]
    public bool ReadOnly { get; set; }
    Property Value
    Type Description
    System.Boolean

    false

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", ReadOnly = true });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    RelativeMode

    Declaration
    [JsonProperty("relativeMode")]
    [JsonConverter(typeof(StringEnumConverter))]
    public LabelRelativeMode RelativeMode { get; set; }
    Property Value
    Type Description
    LabelRelativeMode

    RotateAngle

    Gets or sets the angle to which the label needs to be rotated

    Declaration
    [JsonProperty("rotateAngle")]
    public double RotateAngle { get; set; }
    Property Value
    Type Description
    System.Double

    0

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", RotateAngle = 50 });
               Node.Labels = Labels;

    SegmentOffset

    Declaration
    [JsonProperty("segmentOffset")]
    public double SegmentOffset { get; set; }
    Property Value
    Type Description
    System.Double

    TemplateId

    Gets or sets the font family of the text

    Declaration
    [JsonProperty("templateId")]
    public string TemplateId { get; set; }
    Property Value
    Type Description
    System.String

    ""

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", TemplateId = "LabelTemplate" });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    TemplateType

    Gets or sets whether the label is currently being edited or not

    Declaration
    [JsonConverter(typeof(StringEnumConverter))]
    [JsonProperty("templateType")]
    public TemplateType TemplateType { get; set; }
    Property Value
    Type Description
    TemplateType

    TemplateType.Html

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", TemplateType = TemplateTypes.Svg });
               Node.Labels = labels;
               Model.Nodes.Add(Node);

    Text

    Gets or sets the label text

    Declaration
    [JsonProperty("text")]
    public string Text { get; set; }
    Property Value
    Type Description
    System.String

    String.Empty

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", RotateAngle = 50 });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    TextAlign

    Gets or sets how to align the text inside the label.

    Declaration
    [JsonProperty("textAlign")]
    [JsonConverter(typeof(StringEnumConverter))]
    public TextAlign TextAlign { get; set; }
    Property Value
    Type Description
    TextAlign

    String.Empty

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", RotateAngle = 50 });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    TextDecoration

    Gets or sets how to decorate the label text.

    Declaration
    [JsonConverter(typeof(StringEnumConverter))]
    [JsonProperty("textDecoration")]
    public TextDecorations TextDecoration { get; set; }
    Property Value
    Type Description
    TextDecorations

    TextDecorations.None

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", TextDecoration = TextDecorations.Overline });
               Node.Labels = Labels;
               Model.Nodes.Add(Node);

    TextOverflow

    Declaration
    [JsonProperty("textOverflow")]
    public bool TextOverflow { get; set; }
    Property Value
    Type Description
    System.Boolean

    VerticalAlignment

    Gets or sets the vertical alignment of the label

    Declaration
    [JsonConverter(typeof(StringEnumConverter))]
    [JsonProperty("verticalAlignment")]
    public VerticalAlignment VerticalAlignment { get; set; }
    Property Value
    Type Description
    VerticalAlignment

    VerticalAlignment.Center

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", VerticalAlignment = VerticalAlignment.Stretch });
               Node.Labels = Labels;

    Width

    Gets or sets the width of the label(the maximum value of label width and the node width will be considered as label width)

    Declaration
    [JsonProperty("width")]
    public double Width { get; set; }
    Property Value
    Type Description
    System.Double

    50

    Examples
                Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", Width = 50 });
               Node.Labels = Labels;

    Wrapping

    Gets or sets how the label text needs to be wrapped

    Declaration
    [JsonConverter(typeof(StringEnumConverter))]
    [JsonProperty("wrapping")]
    public TextWrapping Wrapping { get; set; }
    Property Value
    Type Description
    TextWrapping

    TextWrapping.WrapWithOverflow

    Examples
               Node Node = new Node() { Name = "node1", Height = 100, HorizontalAlign = HorizontalAlignment.Right };
               Collection Labels = new Collection();
               Labels.Add(new Label() { Text = "Node1", Name = "Node1", Wrapping = TextWrapping.NoWrap });
               Node.Labels = Labels;

    WrapText

    Declaration
    [Obsolete("Use Wrapping")]
    public bool WrapText { get; set; }
    Property Value
    Type Description
    System.Boolean
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved