HPD

What is the simplest - easiest way to stream a XAML document to a file

I am NOT asking how to write a string to a file, but how I can access the XAML DOM (have been drawing on the client side) in order to get the XAML string I want to save in a file (i.e. save the XAML drawing to a file).

Is there an overall string property representing the full XAML DOM or are there a string property for each XAML item or do I have to build the XAML string by parsing the complete DOM with properties and write the string "manually".

Thanks for any help on this matter.

Kind Regards

Hans P. Dramstad



Re: Silverlight (formerly WPF/E) Developer Issues How to stream XAML code TO a file...?

Kevgor

The SourceString should contain the XAML string you supplied when the control was instantiated - if you used it

However, many people supply a "Source" URl rather than using the SourceString. If you do this there is no way to retrieve the XAML, via the SourceString.

Further, since script acting on the Silverlight likely adds additional content (via ::CreateFromXAML) during the course of the user's interaction of the control, even if you used SourceString, you would not likely be able to get the current XAML.

You're only choice really is to walk the Object Model. I hesitate to call it a DOM, because the Object Model (e.g. the Silverlight API) is not designed according to an XML DOM. You have to become familiar with the Silverlight API and know how to walk it. Also, i'm not completely sure you can get everything back you put into it, since some of the collection API's are not functioning properly in Feb CTP (confirmed in other posts here).

It would be fantastic if we could get the xaml back (or even be able to fully walk the DOM) and serialize it somewhere. The possibilities of the type of applications you could build with such a feature are simply endless.

Kevgor