To reproduce:
1.Add a RadDock with a ToolWindow and a DocumentWindow. Add several controls to all windows. Use the following code:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (System.IO.File.Exists(@"..\..\..\layoutTest.xml"))
this.radDock1.LoadFromXml(@"..\..\..\layoutTest.xml");
}
protected override void OnClosing(CancelEventArgs e)
{
this.radDock1.SaveToXml(@"..\..\..\layoutTest.xml");
base.OnClosing(e);
}
2. Run the application and change the current layout.
3. Close the form and run the application again. The controls which belong to the RadDock's DocumentWindow disappear from the dialog.
Workaround:
class MyDock : RadDock
{
protected override void LoadFromXmlCore(System.Xml.XmlReader reader, bool oldXmlFormat)
{
//stop the base logic
//base.LoadFromXmlCore(reader, oldXmlFormat);
if (reader == null)
{
return;
}
this.ActiveWindow = null;
FieldInfo prevActiveWindow = typeof(RadDock).GetField("prevActiveWindow", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField);
prevActiveWindow.SetValue(this, null); //this.prevActiveWindow = null;
FieldInfo attachedWindows = typeof(RadDock).GetField("attachedWindows", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
SortedList<string, DockWindow> _attachedWindows = attachedWindows.GetValue(this) as SortedList<string, DockWindow>;
MethodInfo CleanAutoHideTabs = typeof(RadDock).GetMethod("CleanAutoHideTabs", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance);
CleanAutoHideTabs.Invoke(this, new object[] { _attachedWindows.Values, true }); //this.CleanAutoHideTabs(this.attachedWindows.Values, true);
MethodInfo ResetDesiredDockState = typeof(RadDock).GetMethod("ResetDesiredDockState", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance);
ResetDesiredDockState.Invoke(this, null); //this.ResetDesiredDockState();
MethodInfo OnLoadingFromXML = this.DocumentManager.GetType().GetMethod("OnLoadingFromXML", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance);
OnLoadingFromXML.Invoke(this.DocumentManager, null); //this.DocumentManager.OnLoadingFromXML();
if (oldXmlFormat)
{
this.BeginTransactionBlock(false);
MethodInfo LoadFromOldXml = typeof(RadDock).GetMethod("LoadFromOldXml", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance);
LoadFromOldXml.Invoke(this, new object[] {reader}); // this.LoadFromOldXml(reader);
this.EndTransactionBlock();
}
else
{
MethodInfo LoadFromNewXml = typeof(RadDock).GetMethod("LoadFromNewXml", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance);
LoadFromNewXml.Invoke(this, new object[] { reader }); // this.LoadFromNewXml(reader);
}
this.EnsureInitialized();
this.OnLoadedFromXml();
}
public override string ThemeClassName
{
get
{
return typeof(RadDock).FullName;
}
}
}