Search code examples
wpfflowdocument

FlowDocument - Prevent breaks between paragraphs


I have a FlowDocument that contains lists with a header:

Header 1           -   Item 2
-   Item 1         
-   Item 2         Header 3
-   Item 3         -   Item 1
                   -   etc.
Header 2
-   Item 1

I want to prevent page/column breaks so that the layout will be like this:

Header 1           Header 2
-   Item 1         -   Item 1
-   Item 2         -   Item 2
-   Item 3         
                   Header 3

I don't want the List including the header to split over mulitple columns or pages. How can I achieve this?

The layout is currently as follows:

  • Paragraph (header)
  • List
    • List Item

Solution

  • Setting the KeepTogether property would prevent column or page breaking inside a paragraph.