This is a migrated thread and some comments may be shown as answers.

UserControl within DocumentWindow not visible after LoadFromXml()

4 Answers 153 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Sri
Top achievements
Rank 1
Sri asked on 15 May 2014, 05:08 PM
I have a single DocumentWindow that I am using to host my own tab control to display a set of tabs.  Prior to calling the LoadFromXml() method to restore a docking layout, I can perform actions within my app that correctly adds tabs to my own tab control.  See attached image "Document Windows - Before Load Layout.jpg".  However, after I call "LoadFromXml()", my tab control disappears.  See attached image "Document Windows - After Load Layout.jpg".

I can inspect the "Parent" property of my tab control, and it is still set to the "DocumentWindow", but my tab control does not show up in "DocumentWindow.Controls" property.  If I force adding my tab control back into the "Controls" list for the DocumentWindow, I still do not see my tab control on the screen.

Can you offer a solution and best practices for how to restore my user controls within a DocumentWindow after a call to LoadFromXml()?

Thank you.

4 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 20 May 2014, 11:44 AM
Hi Sri,

Thank you for contacting us.

With the latest release we addressed an issue which required clearing all windows from the aforementioned collection when loading the layout, so now there are no windows to match from, so no windows are reused, hence the missing controls, as brand new windows are being created during the load operation and they do not have any controls in them.

However, we have discussed this case, and we found another way to address the issue, which required clearing the windows. We will change this in the next release of ours and this will bring back the old behavior (even though it is not quite correct, but this will avoid changes in the behavior). Until then, you can use the following RadDock implementation:
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;
        }
    }
}

The issue is logged in our Feedback Portal and you can find the item here.

Let me know if you have further questions.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Alwin
Top achievements
Rank 1
answered on 21 May 2014, 02:31 PM
This must be a very bad joke...

To which date is the fix terminated?
Untill then it's better for us to disable this feature...

best regards
Alwin
0
HowieD
Top achievements
Rank 1
answered on 22 May 2014, 06:38 AM
What the hell is your QA Department doing???
With every release there are new issues where we have to implement workarounds.
In general it seems that you don't care anything about the problems that emerge on customers side.
Unfortunately our product heavily relys on your controls as I would prefer to switch to an other vendor!
Keep on providing issues then this day will come faster as expected!

Best Regards
HowieD
0
George
Telerik team
answered on 26 May 2014, 01:08 PM
Hello Guys,

I am sorry to hear about your negative experience.

Alwin, the issue at hand is resolved and will be released with Q2 2014 as you can see in the "Scheduled for" tab in the feedback item.

As to Herbert's reply - we strive to provide as bug-free software as much as possible to our customers, however as we can see sometimes such issues slip through. Of course, in such cases we are addressing them as soon as possible.

Do not hesitate to write back, should you have further questions.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Dock
Asked by
Sri
Top achievements
Rank 1
Answers by
George
Telerik team
Alwin
Top achievements
Rank 1
HowieD
Top achievements
Rank 1
Share this question
or