public void WriteXml(XmlWriter writer) { writer.WriteStartElement("RootPanel"); if (RootPanel != null) { RootPanel.WriteXml(writer); } writer.WriteEndElement(); writer.WriteStartElement("TopSide"); if (TopSide != null) { TopSide.WriteXml(writer); } writer.WriteEndElement(); writer.WriteStartElement("RightSide"); if (RightSide != null) { RightSide.WriteXml(writer); } writer.WriteEndElement(); writer.WriteStartElement("LeftSide"); if (LeftSide != null) { LeftSide.WriteXml(writer); } writer.WriteEndElement(); writer.WriteStartElement("BottomSide"); if (BottomSide != null) { BottomSide.WriteXml(writer); } writer.WriteEndElement(); // Write all floating windows (can be LayoutDocumentFloatingWindow or LayoutAnchorableFloatingWindow). // To prevent "can not create instance of abstract type", the type is retrieved with GetType().Name writer.WriteStartElement("FloatingWindows"); foreach (var layoutFloatingWindow in FloatingWindows) { writer.WriteStartElement(layoutFloatingWindow.GetType().Name); layoutFloatingWindow.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("Hidden"); foreach (var layoutAnchorable in Hidden) { writer.WriteStartElement(layoutAnchorable.GetType().Name); layoutAnchorable.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); }