Pregunta

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.

¿Fue útil?

Solución

You can save to a XmlWriter instance, create a XmlWriter, create a XmlWriterSettings instance and set the Indent property 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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top