load DocumentWindow in invisible mode

9 posts, 0 answers
  1. Ivan
    Ivan avatar
    5 posts
    Member since:
    Oct 2014

    Posted 31 Oct 2014 Link to this post

    how to load DocumentWindow in invisible mode?

    I open the second and subsequent tabs:

    Form privatForm= new Form();
    privatForm.Dock = DockStyle.Fill;
    privatForm.TopLevel = false;
     
    DocumentWindow privatDockForm = new DocumentWindow();
    privatDockForm.CloseAction = DockWindowCloseAction.Hide;
    privatDockForm.Text = tabName;
    privatDockForm.Controls.Add(privatForm);
    generalFrm.radDock1.AddDocument(privatDockForm);
    privatDockForm.Show();
    privatForm.Show();

    Not running the event PrivatForm_Load until the user activates it... How to force a load of my privatForm without displaying it to the user?
    and how to add DocumentWindow in the Dock temporarily without creating a tab?
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 31 Oct 2014 Link to this post

    Hi Ivan,

    Thank you for writing.

    I can see that you have found the CloseAction property of the DocumentWindow and you have set it to Hidden. This allows you to hide the form and show it when needed. Once you add it to RadDock, you can call the desired DocumentWindow's Close method, and this will hide it. Then, when you need to show it, you can call its Show method. 

    More information about the object model of RadDock, can be found at the following help section: http://www.telerik.com/help/winforms/dock-object-model-creating-toolwindow-and-documentwindow-at-runtime.html.

    I hope that the provided information addresses your question.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ivan
    Ivan avatar
    5 posts
    Member since:
    Oct 2014

    Posted 31 Oct 2014 in reply to Stefan Link to this post

    Hi Stefan!
    thank you for responding!
    it didn't help... :(

    I need to add DocumentWindow tab is not displayed.
    In your way tab is displayed for a short time before use Close()

    (I need to add DocumentWindow in the background immediately)
  5. Ivan
    Ivan avatar
    5 posts
    Member since:
    Oct 2014

    Posted 31 Oct 2014 in reply to Ivan Link to this post

    the video shows the bad effect of using
    radDock1.AddDocument(privatDockForm);
    privatDockForm.Close();

    https://yadi.sk/d/IqPecYQNcQSBE
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 31 Oct 2014 Link to this post

    Hello Ivan,

    If you call Close, the DocumentWindow tab will not be visible, as the window will be hidden (including its tab). I have just tested this on my end. See attached video (opens in browser).

    Still, if you need to manipulate the DocumentWindow tab, here is how it can be accessed and hidden:
    privatDockForm.TabStripItem.Visibility = ElementVisibility.Collapsed;

    I hope this helps.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Ivan
    Ivan avatar
    5 posts
    Member since:
    Oct 2014

    Posted 31 Oct 2014 in reply to Stefan Link to this post

    Dear Stefan.
    Please try your example with the second and subsequent tabs. Before becoming invisible, the tab is visible a short time.
    Attached 3 screenshots(step by step) from the debugger. On the first screenshot one tab before adding the second. In the second screenshot we can see that the tab is visible. On the third screenshot, it became invisible.
  8. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 05 Nov 2014 Link to this post

    Hello Ivan,

    Thank you for writing back.

    Better approach for this case will be to change the DockState property of the window after it is added:
    Form privatForm = new Form();
    privatForm.Dock = DockStyle.Fill;
    privatForm.TopLevel = false;
     
    DocumentWindow privatDockForm = new DocumentWindow();
    privatDockForm.CloseAction = DockWindowCloseAction.Hide;
    privatDockForm.DockState = DockState.Hidden;
    privatDockForm.Text = "test";
    privatDockForm.Controls.Add(privatForm);
    this.radDock1.AddDocument(privatDockForm);
    privatDockForm.DockState = DockState.Hidden;

    Let me know how this works for you.

    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  9. Ivan
    Ivan avatar
    5 posts
    Member since:
    Oct 2014

    Posted 06 Nov 2014 in reply to Dimitar Link to this post

    Hello, Dimitar.
    Thank you for wasting your time on me :)
    In your example, too, have the appearance tab for a short time, and this causes the flashing effect. I found a solution for myself: adding privatDockForm, I add it first on another invisible dock. Maybe my solution is not very good, but my problem it solves. Thank you very much for your help!
  10. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 07 Nov 2014 Link to this post

    Hi Ivan,

    Thank you for writing back.

    Please note that if you have some heavy operations on the form's load you can consider to separate them in a different class so the form can be loaded faster. I am suggesting this because I cannot see any good reason to load a form that is not visible and how you will benefit from this. Perhaps if you can provide us with a detailed information about your exact case we will be able to provide you with a proper solution.

    In addition I have recorded a small video where you can see that there is no flashing on my side.

    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WinForms is Visual Studio 2017 Ready