Demi Z

Hello All,

I'm trying to dynamically populate a streaming flowdocument into a richtextbox.

Using the following,

RichTextBox documentreader = new RichTextBox();

documentreader.Document = (FlowDocument)XamlReader.Load(mystream);

I get the following exception at the reading of the xaml:

System.Windows.Markup.XamlParseException was unhandled
Message: The tag 'FlowDocument' does not exist in XML namespace ''. Line '1' Position '2'.

The contents of mystream, currently is: "<FlowDocument />" as I've simpled it down quite a bit trying to troubleshoot Smile

Does anybody have any ideas I'd really appreciate the help,

D



Re: Windows Presentation Foundation (WPF) FlowDocument in RichTextBox namespace error

Ben Ronco - MSFT

Do you have the WPF namespace declared

<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />





Re: Windows Presentation Foundation (WPF) FlowDocument in RichTextBox namespace error

Demi Z

I'm a little stunned that that worked. It is so simple (and I swear I tried it already Stick out tongue). But, can you clarify why that is necessary I'm adding to an existing control in an existing xaml page where that is defined.





Re: Windows Presentation Foundation (WPF) FlowDocument in RichTextBox namespace error

Ben Ronco - MSFT

The parser needs it as a reference. This happens before your element ever gets to the page that you are adding it to.