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
2010-02-09 00:08:32
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
2010-02-09 00:18:32
@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
2010-02-09 01:22:54
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
2010-02-09 02:27:24
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
2010-02-09 18:33:07