Telerik C# ToolWindow vs DocumentWindow?

2 posts, 0 answers
  1. Max
    Max avatar
    1 posts
    Member since:
    Feb 2020

    Posted 02 Apr 2020 Link to this post

    Hello,

    I'm looking at some Telerik code that was written by another engineer who worked on our Telerik code maybe a year or two ago. He had built 12 or so Telerik WinControls and all of them -- except one -- are Telerik.WinControls.UI.Docking.ToolWindow (s).

    For the one that isn't a ToolWindow, the WinControl is a Telerik.WinControls.UI.Docking.DocumentWindow.

    From a quick google search, it appears the ToolWindow and the DocumentWindow work in essentially the same way, but what I am observing is that the DocumentWindow control doesn't re-create itself if that control was closed on the previous run of our application. All of the ToolWindow controls DO re-create themselves if closed on the previous run of our application.

    Further, there is a dock.xml file that gets created at the conclusion of running our application. It appears all the ToolWindow controls get saved into that file, but the DocumentWindow control does not. Unsure if this is due to bad code on our side, or just intended behavior (haven't dug deep into this).

    ...

    To state one specific question: Is it safe to just change the one DocumentWindow to a ToolWindow?

    - Max

  2. Nadya
    Admin
    Nadya avatar
    459 posts

    Posted 07 Apr 2020 Link to this post

    Hello Max,

    Thank you for the provided information.

    Note that although DocumentWindow and ToolWindow implement the same interface and have a common set of properties, they differ from each other in their run time behavior.  The windows in RadDock are arranged in tab strips depending on the type of the window, for example, ToolWindows are arranged in ToolTabStrip and DocumentWindows are arranged in DocumentTabStrip

    However, it is possible to change programmatically DocumentWindow with a ToolWindow I could say that it is not recommended to do so. Since I am not familiar in details with your project it is up to you to choose which window to use.

    RadDock control is a dynamic control and its containers for both DocumentWindow and ToolWindow are frequently recreated. The reason why a DockWindow is not saved to the .XML file can depend on the CloseAction property. Note that RadDock has two different methods (CloseWindow and RemoveWindow) which you can call if you want to remove a window. The result from these methods depends on the CloseAction property which can have one of these values:
    - Close: this window is closed and detached (but not disposed) from its RadDock. You cannot manage it from RadDock collections anymore.
    - Hide: this window is only closed (hidden) in RadDock. However, this window is not detached from its RadDock and you can manage it from the RadDock collections.
    -CloseAndDispose: this window is closed and then disposed.

    So, if a DocumentWindow/ToolWindow is disposed it may not be saved to the file.

    Please refer to the following help articles for more information:
    https://docs.telerik.com/devtools/winforms/controls/dock/object-model/removing-toolwindow-and-documentwindow-at-runtime
    https://docs.telerik.com/devtools/winforms/controls/dock/object-model/toolwindow-and-documentwindow-properties-and-methods

    I hope this information helps. Should you have other questions do not hesitate to ask.

    Regards,
    Nadya
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top