Edit this page
Available for: UI for ASP.NET AJAX | UI for ASP.NET MVC | UI for WPF | UI for WinForms

Break

Break element is an inline-level flow content element, which specifies that a break should be placed at the current location. There are three types of breaks:

  • Line Break: The break restarts the document content on the next line in the document.

  • Page Break: The break restarts the document content on the next page of the document.

  • Column Break: The break restarts the document content on the next column available on the current page of the document.

Inserting a Break

All inline-level elements in a RadFlowDocument need to be placed within another element.

Example 1 shows how to create a Break element and add it to a Paragraph.

[C#] Example 1: Create break

Break br = new Break(document);
paragraph.Inlines.Add(br);

Note, that the paragraph should belong to the same document that is passed to the constructor of the Break element. The code in Example 1 inserts a Break element of the default break type – Line break. You can change the type of a Break through its BreakType property.

Example 2 shows how you can change the type of the break created in Example 1.

[C#] Example 2: Change BreakType

br.BreakType = BreakType.PageBreak;

Inserting a break in the document can also be done with the InsertBreak() method of the RadFlowDocumentEditor class.

Example 3 shows how you can insert a break through RadFlowDocumentEditor.

[C#] Example 3: Insert break using RadFlowDocumentEditor

RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());
Break br = editor.InsertBreak(BreakType.PageBreak);

Modifying a Break

The Break element exposes several properties that allow you to customize it.

  • BreakType: Specifies the type of the break.

  • TextWrappingRestartLocation: Specifies the text wrapping restart location. This property affects the restart location only if BreakType is set to LineBreak, otherwise it is ignored. The possible values are:

    • NextLine: Specifies that the line break advances the text to the next line in the document.

    • NextFullLine: Specifies that the line break advances the text to the next line in the document, which is not interrupted by any floating objects.

    • NextTextRegionUnblockedOnLeft: Specifies that the line break advances the text to the next line in the document, which is not interrupted by any floating objects on the left.

    • NextTextRegionUnblockedOnRight: Specifies that the line break advances the text to the next line in the document, which is not interrupted by any floating objects on the right.

Example 4 shows how you can insert a Break through RadFlowDocumentEditor and modify it later.

[C#] Example 4: Customize a break

RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());

Break br = editor.InsertBreak(BreakType.PageBreak);
br.BreakType = BreakType.LineBreak;
br.TextWrappingRestartLocation = TextWrappingRestartLocation.NextFullLine;

See Also