Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| // <SnippetSimpleFlowCodeOnlyExampleWholePage> | |
| using System; | |
| using System.Windows; | |
| using System.Windows.Controls; | |
| using System.Windows.Documents; | |
| namespace SDKSample | |
| { | |
| public partial class SimpleFlowExample : Page | |
| { | |
| public SimpleFlowExample() | |
| { | |
| Paragraph myParagraph = new Paragraph(); | |
| // Add some Bold text to the paragraph | |
| myParagraph.Inlines.Add(new Bold(new Run("Some bold text in the paragraph."))); | |
| // Add some plain text to the paragraph | |
| myParagraph.Inlines.Add(new Run(" Some text that is not bold.")); | |
| // Create a List and populate with three list items. | |
| List myList = new List(); | |
| // First create paragraphs to go into the list item. | |
| Paragraph paragraphListItem1 = new Paragraph(new Run("ListItem 1")); | |
| Paragraph paragraphListItem2 = new Paragraph(new Run("ListItem 2")); | |
| Paragraph paragraphListItem3 = new Paragraph(new Run("ListItem 3")); | |
| // Add ListItems with paragraphs in them. | |
| myList.ListItems.Add(new ListItem(paragraphListItem1)); | |
| myList.ListItems.Add(new ListItem(paragraphListItem2)); | |
| myList.ListItems.Add(new ListItem(paragraphListItem3)); | |
| // Create a FlowDocument with the paragraph and list. | |
| FlowDocument myFlowDocument = new FlowDocument(); | |
| myFlowDocument.Blocks.Add(myParagraph); | |
| myFlowDocument.Blocks.Add(myList); | |
| // Add the FlowDocument to a FlowDocumentReader Control | |
| FlowDocumentReader myFlowDocumentReader = new FlowDocumentReader(); | |
| myFlowDocumentReader.Document = myFlowDocument; | |
| this.Content = myFlowDocumentReader; | |
| } | |
| } | |
| } | |
| // </SnippetSimpleFlowCodeOnlyExampleWholePage> |