Class FlowDocumentExtensions
Fluent type extensions for manipulating FlowDocument objects.
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.Wpf.FlowDocumentExtensions.dll
Syntax
public static class FlowDocumentExtensions
Methods
| Edit this page View SourceAddTable(FlowDocument, IEnumerable<KeyValuePair<string, GridLength>>)
Adds a new table to the specified FlowDocument.
Declaration
public static Table AddTable(this FlowDocument document, IEnumerable<KeyValuePair<string, GridLength>> columns)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | document | Document to which the new table will be added. |
| IEnumerable<KeyValuePair<string, GridLength>> | columns | Columns to add. |
Returns
| Type | Description |
|---|---|
| Table | A reference to the newly created table. |
AddTable(FlowDocument, params GridLength[])
Adds a new table to the specified FlowDocument.
Declaration
public static Table AddTable(this FlowDocument document, params GridLength[] columnWidths)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | document | Document to which the new table will be added. |
| GridLength[] | columnWidths | Column widths to set. |
Returns
| Type | Description |
|---|---|
| Table | A reference to the newly created table. |
Done<T>(FrameworkContentElement)
Marks the end of the context of an element, returning to its parent.
Declaration
public static T Done<T>(this FrameworkContentElement block) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| FrameworkContentElement | block | Block from which to obtain the parent. |
Returns
| Type | Description |
|---|---|
| T | The parent of the specified element. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the parent to return. |
Exceptions
| Type | Condition |
|---|---|
| InvalidCastException | Thrown if the parent of the element is not of type
|
MakeTable(FlowDocument, IEnumerable<string>)
Constructs a new table with the specified headers.
Declaration
public static TableRowGroup MakeTable(this FlowDocument fd, IEnumerable<string> headers)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument in which the created table will be added. |
| IEnumerable<string> | headers | Headers to add to the table. |
Returns
| Type | Description |
|---|---|
| TableRowGroup | A reference to a new TableRowGroup within the created table. |
MakeTable(FlowDocument, IEnumerable<string>, ICellStyle?)
Constructs a new table with the specified headers.
Declaration
public static TableRowGroup MakeTable(this FlowDocument fd, IEnumerable<string> headers, ICellStyle? headersStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument in which the created table will be added. |
| IEnumerable<string> | headers | Headers to add to the table. |
| ICellStyle | headersStyle | Optional style to apply to the table headers. |
Returns
| Type | Description |
|---|---|
| TableRowGroup | A reference to a new TableRowGroup within the created table. |
MakeTable<T>(FlowDocument, IEnumerable<IColumnBuilder<T>>, IEnumerable<T>)
Constructs a table from a data enumeration and a collection of column descriptors.
Declaration
public static Table MakeTable<T>(this FlowDocument fd, IEnumerable<IColumnBuilder<T>> columns, IEnumerable<T> data)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument in which the created table will be added. |
| IEnumerable<IColumnBuilder<T>> | columns | Collection of columns to include in the table. |
| IEnumerable<T> | data | Enumeration of data to include in the table. |
Returns
| Type | Description |
|---|---|
| Table |
|
Type Parameters
| Name | Description |
|---|---|
| T | Type of elements to include in the table. |
MakeTable<T>(FlowDocument, IEnumerable<IColumnBuilder<T>>, IEnumerable<T>, ICellStyle?)
Constructs a table from a data enumeration and a collection of column descriptors.
Declaration
public static Table MakeTable<T>(this FlowDocument fd, IEnumerable<IColumnBuilder<T>> columns, IEnumerable<T> data, ICellStyle? headersStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument in which the created table will be added. |
| IEnumerable<IColumnBuilder<T>> | columns | Collection of columns to include in the table. |
| IEnumerable<T> | data | Enumeration of data to include in the table. |
| ICellStyle | headersStyle | Optional style to apply to the table headers. |
Returns
| Type | Description |
|---|---|
| Table |
|
Type Parameters
| Name | Description |
|---|---|
| T | Type of elements to include in the table. |
Paragraph(FlowDocument)
Creates a new paragraph.
Declaration
public static Paragraph Paragraph(this FlowDocument fd)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument in which the new paragraph will be added. |
Returns
| Type | Description |
|---|---|
| Paragraph | A reference to the new Paragraph that has been added to the document. |
Paragraph(FlowDocument, string)
Creates a new paragraph.
Declaration
public static FlowDocument Paragraph(this FlowDocument fd, string content)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument in which the new paragraph will be added. |
| string | content | Content of the new paragraph. |
Returns
| Type | Description |
|---|---|
| FlowDocument |
|
Paragraph(FlowDocument, string, TextAlignment)
Creates a new paragraph.
Declaration
public static FlowDocument Paragraph(this FlowDocument fd, string content, TextAlignment alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument in which the new paragraph will be added. |
| string | content | Content of the new paragraph. |
| TextAlignment | alignment | Text alignment of the new paragraph. |
Returns
| Type | Description |
|---|---|
| FlowDocument |
|
Print(FlowDocument, string)
Prints a FlowDocument using the operating system's print dialog.
Declaration
public static void Print(this FlowDocument fd, string title)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument to print. |
| string | title | Title of the document to print. |
PrintDirect(FlowDocument, string)
Directly prints a FlowDocument without going through the operating system's print dialog.
Declaration
public static void PrintDirect(this FlowDocument fd, string title)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | FlowDocument to print. |
| string | title | Title of the document to print. |
Run(Paragraph, string)
Adds a text block to the paragraph.
Declaration
public static Paragraph Run(this Paragraph paragraph, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| Paragraph | paragraph | Paragraph to which to add the new text. |
| string | text | Text to add. |
Returns
| Type | Description |
|---|---|
| Paragraph |
|
Style(Paragraph, FontWeight)
Sets the font weight of the paragraph.
Declaration
public static Paragraph Style(this Paragraph paragraph, FontWeight weight)
Parameters
| Type | Name | Description |
|---|---|---|
| Paragraph | paragraph | Paragraph to set the font weight for. |
| FontWeight | weight | Font weight in the paragraph. |
Returns
| Type | Description |
|---|---|
| Paragraph |
|
Style(Paragraph, TextAlignment)
Sets the alignment of the paragraph.
Declaration
public static Paragraph Style(this Paragraph paragraph, TextAlignment alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| Paragraph | paragraph | Paragraph to set the text alignment for. |
| TextAlignment | alignment | Text alignment to use in the paragraph. |
Returns
| Type | Description |
|---|---|
| Paragraph |
|
Style(Paragraph, TextAlignment, FontWeight)
Sets the alignment and font weight values for the paragraph.
Declaration
public static Paragraph Style(this Paragraph paragraph, TextAlignment alignment, FontWeight weight)
Parameters
| Type | Name | Description |
|---|---|---|
| Paragraph | paragraph | Paragraph to apply the style parameters to. |
| TextAlignment | alignment | Text alignment to use in the paragraph. |
| FontWeight | weight | Font weight in the paragraph. |
Returns
| Type | Description |
|---|---|
| Paragraph |
|
Text(BlockCollection, string)
Adds a text block to the specified collection of text blocks.
Declaration
public static Paragraph Text(this BlockCollection blocks, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| BlockCollection | blocks | Collection of text blocks to which to add a new text block. |
| string | text | Text to add. |
Returns
| Type | Description |
|---|---|
| Paragraph | A reference to the new Paragraph that has been added to the collection of text blocks. |
Text(FlowDocument, string)
Adds a simple text block to the document.
Declaration
public static FlowDocument Text(this FlowDocument fd, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | Document in which to add the new text block. |
| string | text | Text to add. |
Returns
| Type | Description |
|---|---|
| FlowDocument |
|
Text(FlowDocument, string, TextAlignment)
Adds a simple text block to the document.
Declaration
public static FlowDocument Text(this FlowDocument fd, string text, TextAlignment alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | Document in which to add the new text block. |
| string | text | Text to add. |
| TextAlignment | alignment | Text alignment to use. |
Returns
| Type | Description |
|---|---|
| FlowDocument |
|
Title(FlowDocument, string)
Adds a title-formatted text to the document.
Declaration
public static FlowDocument Title(this FlowDocument fd, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | Document in which to add the new text block. |
| string | text | Title text to add. |
Returns
| Type | Description |
|---|---|
| FlowDocument |
|
Title(FlowDocument, string, byte)
Adds a title-formatted text to the document.
Declaration
public static FlowDocument Title(this FlowDocument fd, string text, byte level)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | Document in which to add the new text block. |
| string | text | Title text to add. |
| byte | level | Title level to add. |
Returns
| Type | Description |
|---|---|
| FlowDocument |
|
Title(FlowDocument, string, byte, TextAlignment)
Adds a title-formatted text to the document.
Declaration
public static FlowDocument Title(this FlowDocument fd, string text, byte level, TextAlignment alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | Document in which to add the new text block. |
| string | text | Title text to add. |
| byte | level | Title level to add. |
| TextAlignment | alignment | Text alignment to use. |
Returns
| Type | Description |
|---|---|
| FlowDocument |
|
Title(FlowDocument, string, TextAlignment)
Adds a title-formatted text to the document.
Declaration
public static FlowDocument Title(this FlowDocument fd, string text, TextAlignment alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowDocument | fd | Document in which to add the new text block. |
| string | text | Title text to add. |
| TextAlignment | alignment | Text alignment to use. |
Returns
| Type | Description |
|---|---|
| FlowDocument |
|
ToDocumentTable(ListView)
Declaration
public static Table ToDocumentTable(this ListView listView)
Parameters
| Type | Name | Description |
|---|---|---|
| ListView | listView | ListView to process. |
Returns
| Type | Description |
|---|---|
| Table | A Table with the content of the active view of the ListView. |