public override void SaveElementToXml(XmlWriter xmlWriter)
{
// Find the ordered position of this dockspace inside the parent control
Control parent = DockspaceControl.Parent;
if (parent != null)
{
// Count the number of KryptonDockspace that occur after ourself in the collection by scanning
// backwards from end of collection to the front.
int numDockspace = 0;
for (int i = parent.Controls.Count - 1; i >= 0; i--)
{
Control child = parent.Controls[i];
if (child == DockspaceControl)
break;
else if (child is KryptonDockspace)
numDockspace++;
}
Order = numDockspace;
}
// Let base class save the pages into the dockspace
base.SaveElementToXml(xmlWriter);
}