WPF C# Tutorial

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="FlowContent" Height="400" Width="600">
    
          
      
        Create a Dynamic Document
      

      Largest Cities in the Year 100
      
        
          
          
          
        

        
          
            
              Title 1
            
            
              Title 2
            

            
              Title 3
            

          
          
            
              A
            

            
              A
            

            
              A
            

          

        
      

    

  

//File:Window.xaml.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Documents
{
    public partial class FlowContent : System.Windows.Window
    {
        public FlowContent()
        {
            InitializeComponent();           
        }
        private void cmdCreateDynamicDocument_Click(object sender, RoutedEventArgs e)
        {
            Run runFirst = new Run();
            runFirst.Text = "A ";
            Bold bold = new Bold();
            Run runBold = new Run();
            runBold.Text = "bold ";
            bold.Inlines.Add(runBold);
            Run runLast = new Run();
            runLast.Text = " documents";
            Paragraph paragraph = new Paragraph();
            paragraph.Inlines.Add(runFirst);
            paragraph.Inlines.Add(bold);
            paragraph.Inlines.Add(runLast);
            FlowDocument document = new FlowDocument();
            document.Blocks.Add(paragraph);
            docViewer.Document = document;
        }
    }
}