Back to Devexpress

AlignedTitle.WordWrap Property

corelibraries-devexpress-dot-xtracharts-dot-alignedtitle.md

latest4.4 KB
Original Source

AlignedTitle.WordWrap Property

Gets or sets whether a title’s text should wrap when it’s too lengthy.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public bool WordWrap { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
Public Property WordWrap As Boolean

Property Value

TypeDescription
Boolean

true , if a title’s text should wrap; otherwise, false.

|

Remarks

Use the WordWrap property to enable automatic word wrapping for lengthy titles.

After you enable the WordWrap property, the AlignedTitle.MaxLineCount property is in effect, allowing you to determine the number of lines that will appear when a title’s text is wrapped. Note that if a title’s length exceeds this limit, the last line of text will be cut off.

The following images demonstrates how these properties work for chart titles.

|

WordWrap = false

|

WordWrap = true

MaximumLinesCount = 0

|

WordWrap = true

MaximumLinesCount = 2

| | --- | --- | --- | |

|

|

|

Example

This example demonstrates how word-wrapping can be enabled for chart titles at runtime. In addition, you can determine the maximum number of lines in which a title is allowed to wrap.

csharp
// Create a title and add it to the chart's collection.
ChartTitle chartTitle1 = new ChartTitle();
ChartControl1.Titles.Add(chartTitle1);
chartTitle1.Text = "Just a Very Lengthy Title for Such a Small Chart";

// Enable word-wrapping for the title,
// and define a limit for its lines.
chartTitle1.WordWrap = true;
chartTitle1.MaxLineCount = 2;
vb
' Create a title and add it to the chart's collection.
Dim chartTitle1 As New ChartTitle()
myChart.Titles.Add(chartTitle1)
chartTitle1.Text = "Just a Very Lengthy Title for Such a Small Chart"

' Enable word-wrapping for the title,
' and define a limit for its lines.
chartTitle1.WordWrap = True
chartTitle1.MaxLineCount = 2

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the WordWrap property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-chart-create-and-customize-chart-titles/CS/Form1.cs#L22

csharp
chartTitle2.WordWrap = true;
chartTitle2.MaxLineCount = 2;

winforms-chart-create-and-customize-chart-titles/VB/Form1.vb#L23

vb
chartTitle2.Text = "The capability to word-wrap is available for chart titles."
chartTitle2.WordWrap = True
chartTitle2.MaxLineCount = 2

See Also

Chart Titles

AlignedTitle Class

AlignedTitle Members

DevExpress.XtraCharts Namespace