Break
The Break element is an inline-level flow content element, which specifies that a break is 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 must be placed within another element.
Example 1 shows how to create a Break element and add it to a Paragraph.
Example 1: Create a Break
Break br = new Break(document);
paragraph.Inlines.Add(br);
The paragraph must 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 to change the type of the break created in Example 1.
Example 2: Change the BreakType
br.BreakType = BreakType.PageBreak;
You can also insert a break in the document with the InsertBreak() method of the RadFlowDocumentEditor class.
Example 3 shows how to insert a break through RadFlowDocumentEditor.
Example 3: Insert a 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 ifBreakTypeis set toLineBreak. 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 to insert a Break through RadFlowDocumentEditor and modify it later.
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;