Show AutoHidden ToolWindow during runtime

6 posts, 1 answers
  1. Viktor
    Viktor avatar
    2 posts
    Member since:
    Mar 2011

    Posted 01 Jul 2011 Link to this post

    Hello Telerik,

    I want to show a ToolWindow which is in Autohide state during runtime. (It should just display not change the DockingState)

    I tried ToolWindow.Show(), but the Window isn't shown


    How can I do that?
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 06 Jul 2011 Link to this post

    Hi Viktor,

    Thank you for writing.

    Consider the following code snippet which achieves your scenario:

    ToolWindow toolWindow = new ToolWindow("Tool Window");
    this.radDock1.DockWindow(toolWindow, toolWindow, DockPosition.Left);
    toolWindow.AutoHide();

    I hope this will help you. If you have further questions, I would be glad to help.

     

    Kind regards,
    Ivan Petrov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Viktor
    Viktor avatar
    2 posts
    Member since:
    Mar 2011

    Posted 07 Jul 2011 Link to this post

    Hello Ivan,

    Thank you for your reply.

    This part is working fine, but what about the other way around?

    Now showing this Hidden Toolwindow ?

    As i told before, i tried Toolwindow.Show() but that doesn't work.

    I don't want t change the DockingState, I only want to show the ToolWindow


    Regards Viktor
  5. Answer
    Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 13 Jul 2011 Link to this post

    Hi Viktor,

    Thank you for your replay.

    From what I understand you want to show a given tool window that is already hidden as if you have hovered it with the mouse. For this scenario you will have to use reflection as the method which is responsible for the showing of a tool window is not public. Please consider the following code snippet:

    MethodInfo method = this.radDock1.GetType().GetMethod("ShowAutoHidePopup", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
     
    if (method != null)
    {
      method.Invoke(this.radDock1, new object[] { this.toolWindow.AutoHideTab, AutoHideDisplayReason.TabItemClicked });
    }
    In the above snippet this.toolWindow is the tool window you want to show. In my case I have as a field, because I use the code snippet from my previous post to add a tool window to the dock.

    I hope this is what you are looking for. Should you have further questions, feel free to contact us.

    All the best,
    Ivan Petrov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  6. Francois
    Francois avatar
    52 posts
    Member since:
    Dec 2010

    Posted 07 Feb 2012 Link to this post

    That code doesn't seem to work anymore with 2011 Q3 SP1, am I wrong?

    EDIT: Nevermind ;)
  7. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 10 Feb 2012 Link to this post

    Hi Francois,

    Thank you for writing.

    In case someone else looks for this information, there is now a public ShowAutoHidePopup method which can be used to accomplish this task.

    If you have other questions, feel free to write back.

    All the best,
    Ivan Petrov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready