public XamlWriter(TextWriter output, XamlWriterSettings settings = null, bool closeOutputStream = true)
{
_writer = XmlWriter.Create(output,
new XmlWriterSettings { CloseOutput = closeOutputStream, Indent = true, IndentChars = " ", OmitXmlDeclaration = true });
if (settings == null)
{
StartRoot("ContentControl");
return;
}
settings.RegisterReferences(this);
StartRoot(settings.RootElement ?? "ContentControl");
_writer.WriteAttributeString("xmlns", "x", null, "http://schemas.microsoft.com/winfx/2006/xaml");
WriteAllReferences();
settings.ApplyCustomizations(this);
}