tags:

views:

289

answers:

1

In a WPF application, how can I save a dynamically rendered page as a new XAML file?

+3  A: 

Use the XamlWriter to convert an object to XAML.

string xaml = XamlWriter.Save(page)

or

XamlWriter.Save(page, stream)

Where page is your dynamically rendered page object.

Matt Bridges
That's close but that only gets me the XAML code, it does not get me the dynamic, rendered result with the filled datagrid and what-not
Jim Beam
@Jim: you should go back and modify your question to include all the requirements, instead of waiting for people to answer before saying "nah, that's not what i want".
slugster
Please go back and read the question. It clearly states that I'm looking for the dynamically rendered result of the XAML. There is absolutely no difference between my original question and the comment above.
Jim Beam
Your original question says nothing about a datagrid. You say it "only gets [you] the XAML code" -- your question specifically asks for a XAML file i.e. code. The phrase "dynamically rendered page" means nothing without any context.
Matt Bridges