flowdocument format : xaml and xamlpackage

Hi,

I am working on an editor using the RTB and I am comparing these two dataformats, the usual xaml and xamlpackage, that TextRange can handle.

1. Can IE open an xamlpackage document ? I know that IE7 can display an xaml doc properly but I haven't got an xamlpackage doc on hand to test with.

2. Apart from TextRange, is there any other classes that provides methods to load & save xamlpackage directly ? A limitation of TextRange is that it loads & saves only a range within the flowdocument but not the complete flowdoc as with using XamlReader & XamlWriter.

Thanks in advance.

[624 byte] By [FrancisShum] at [2007-12-27]
# 1

XamlPackage is only supported by TextRange/RichTextBox. There's no built in support for other contexts like the browser. In practice, it's designed for situations like clipboard support where content is shuffled back and forth from a FlowDocument instance.

You can load/save an entire FlowDocument like this:

TextRange range = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
range.Save(stream, DataFormats.XamlPackage);

The only reason why you would want to use XamlPackage over Xaml is that the former copies the bits of any Images in your content. If you don't have to worry about Images, you're not losing anything by using the Xaml format.

Ben

BenWestbrook-MSFT at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2

That's all that I would like to know. Thank you.

FrancisShum at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified