"Unable to cast object of type 'System.Windows.Documents.FlowDocument' to type 'Telerik.Windows.Documents.Model.RadDocument'."
The file I am trying to import is:
<FlowDocument
xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
<Paragraph FontFamily="Calibri" FontWeight="Bold" FontSize="24">
WPF Flow Documents</Paragraph>
<Paragraph>WPF Flow Documents are <Italic>quite sophisticated</Italic>.
They support all common layout options, as well as many you probably
do <Span Foreground="Red">not expect</Span>.</Paragraph>
<List>
<ListItem><Paragraph>First List Item</Paragraph></ListItem>
<ListItem><Paragraph>Second List Item</Paragraph></ListItem>
<ListItem><Paragraph>Third List Item</Paragraph></ListItem>
</List>
<Paragraph>Of course, Flow Documents also support the definition
of <Bold><Span FontFamily="Comic Sans MS" FontSize="24"
Foreground="Blue">in line</Span></Bold> font sizes and font faces.
</Paragraph>
</FlowDocument>
My code is:
FileStream
xamlInStream = new FileStream(@"C:\testimport.xaml",FileMode.Open,FileAccess.Read);
XamlFormatProvider xamlFormatProvider = new XamlFormatProvider();
RadDocument radDocument = xamlFormatProvider.Import(xamlInStream);
editor.Document = radDocument;
What do I need to do to open standard xaml files. Also, I noticed that when documents are saved as xaml documents the file format is of a RadDocument, is there a way to get a standard FlowDocument from the text box?