I need to write XAML of a WPF control to string. I used XamlWriter.Save(). It works good. Also I need to format, indent and show the string in a editor (read only) like VS Xaml code view. I dont know how to do this.
Please share your valuable ideas.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can save to a XmlWriter instance, create a XmlWriter, create a XmlWriterSettings instance and set the
Indentproperty to true and set this on your XmlWriter. That way you should have the indentation.Now for a control to display it, you could use the RichTextBox in wpf, or look for a custom control around the web.