Binding to FlowDocumentReader Document field help?...

Feb 28, 2013 at 2:47 AM

OS: Windows 7 SP1
IDE: VS 2010 Express
WPF Project: .NET 4.0
Code Practice: Prism, Unity, MVVM

I've seen posts on the internet regarding the Binding to a FlowDocument, but these post were all dated 2007-8 and all referred to a class name BindableRun. Has this limitation been updated for the .NET 4+ and if so can anyone link me to an example or documentation?

Here my code in what I trying to do and I don't to stray away using the FlowDocumentReader:

The View:
            Document="{Binding FlowDocumentText}" 
            Grid.Row="1" ViewingMode="{Binding Path=ReaderViewingMode}">
The ViewModel:
    public DelegateCommand ShowCoreFilePropertiesPart { get; set; }

    public SpreadsheetDocumentVM(IUnityContainer container, IEventAggregator eventAggregator, IRegionManager regionManager)

        this.flowDocumentText = new FlowDocument();
        this.flowDocumentText.FontSize = 16;
        this.readerViewingMode = FlowDocumentReaderViewingMode.Scroll;

        ShowCoreFilePropertiesPart = new DelegateCommand(OnShowCoreFilePropertiesPart);

    private FlowDocument flowDocumentText;
    public FlowDocument FlowDocumentText
        get { return flowDocumentText; }
            flowDocumentText = value;
            RaisePropertyChanged(() => FlowDocumentText);

    public void ShowCoreFilePropertiesPart()
        SpreadsheetDocument document = this.excelService.GetSpreadSheetDocument();

        string runText =
            "This text has some altered typography characteristics.  Note" +
            "that use of an open type font is necessary for most typographic" +
            "properties to be effective.";

        //References to the workbook and Shared String Table.
        Workbook workbook = document.WorkbookPart.Workbook;
        Sheets sheets = document.WorkbookPart.Workbook.Sheets;

        // Create paragraph with some text.
        Paragraph parTitle = new Paragraph();
        parTitle.FontSize = 18;
        parTitle.FontWeight = FontWeights.Bold;
        parTitle.Inlines.Add("Spreadsheet Document");

        Paragraph parSub = new Paragraph();
        parSub.FontSize = 12;
        parSub.FontWeight = FontWeights.Thin;

        Paragraph parCoreFilePropertiesPart = new Paragraph();
        parCoreFilePropertiesPart.Inlines.Add("Core File Properties Part");
        parCoreFilePropertiesPart.Inlines.Add(new LineBreak());
        parCoreFilePropertiesPart.Inlines.Add("ContentType: " + document.CoreFilePropertiesPart.ContentType);
        parCoreFilePropertiesPart.Inlines.Add(new LineBreak());
        parCoreFilePropertiesPart.Inlines.Add("RelationshipType: " + document.CoreFilePropertiesPart.RelationshipType);
        parCoreFilePropertiesPart.Inlines.Add(new LineBreak());
        parCoreFilePropertiesPart.Inlines.Add("Uri: " + document.CoreFilePropertiesPart.Uri.ToString());
        parCoreFilePropertiesPart.Inlines.Add(new LineBreak());
        parCoreFilePropertiesPart.Inlines.Add("DocumentType: " + document.DocumentType.ToString());

        RaisePropertyChanged(() => FlowDocumentText);
After the view is loaded I'm using a RibbonButton to load Excel info to the FlowDocument, but it's not updating, when I load the info during initialization is display's, but I need to be able to minipulate the FlowDocument programmically to add more info.

Any help would really be appreciated! Let me know if you need more info. Thanks for your help!.. :)