Windows restored to their original size after docking.

6 posts, 0 answers
  1. Frank
    Frank avatar
    6 posts
    Member since:
    Sep 2011

    Posted 19 Sep 2011 Link to this post

    Is there a way to have RadPanes restored to their original size after they been "undocked"?  If I dock a floating window, then undock it, the RadPane's size is not restored to the previous size.  All RadPanes are resized to the same small size, regardless of their original dimensions.
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 22 Sep 2011 Link to this post

    Hi Frank,

    In order to achieve this, you need to set the size of the ToolWindows every time they are created. You can do this like so:
    - first get the ToolWindow

    private ToolWindow GetToolWindow(RadPane pane)
    {
        ToolWindow window = pane.ParentOfType<ToolWindow>();
        if (window == null)
        {
            window = (((pane.Parent as RadPaneGroup).Parent as RadSplitContainer).Parent) as ToolWindow;
        }
        return window;
    }

    - after that in the PaneStateChange event set the desired size:

    private void radDocking_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
        foreach (RadPane pane in radDocking.Panes)
        {
            if (pane != null && pane.IsFloating)
            {
                ToolWindow toolWindow = GetToolWindow(pane);
                toolWindow.Height = 20;
                toolWindow.Width = 20;
            }
        }
    }

    Hope this helps.

    Greetings,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
  4. Frank
    Frank avatar
    6 posts
    Member since:
    Sep 2011

    Posted 23 Sep 2011 Link to this post

    Konstantina,

    Thanks for the example, this seems to work, but only part of the time.  When it works, it works fine.  However, about half of the time the window does not get restored to the proper size on the screen.  The window actually "knows" its proper size because if you try to resize it with the mouse, it will "jump" to that size before updating.  Meaning that the window's data contains the correct values, but there appears to be a glitch in the rendering of the control on the screen.  Is there a way to force a control (the window) to be redrawn on the screen?  Perhaps something after InvalidateMeasure() is called?

    Thanks,
    Frank
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 29 Sep 2011 Link to this post

    Hello Frank,

    Sorry, but I wasn't able to reproduce the behaviour you are describing. However, I can suggest you even better approach - instead of writing GetToolWindow() method, you could use the build-in one, which is faster and more clearer.

    private void radDocking_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
           {
               var pane = e.OriginalSource as RadPane;
               if (pane != null)
               {
                           var toolWindow = pane.GetParentToolWindow();
                           if (toolWindow != null)
                           {
                               toolWindow.Height = 100;
                               toolWindow.Width = 100;
                           }
                 }
           }


    Please try with it and let us know if that resolved the issue. If you still experience it, could you please try to reproduce it in a sample project and send it back to us. In that way we will be able to track down the source of the problem and provide you with a solution in a timely manner.

    Greetings,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Ben
    Ben avatar
    3 posts
    Member since:
    Aug 2013

    Posted 02 Dec 2014 Link to this post

    Just wanted to confirm Frank's issue (despite 3 years having passed) where the control still needs an 'InvalidateMeasure' or some sort of redraw after resizing the tool window. The change will not propagate until clicking the window with a mouse.
  7. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 05 Dec 2014 Link to this post

    Hi Eddie,

    We are not aware of the explained issue and were not able to reproduce it. Can you please share some sample code and a video demonstrating the exact scenario? This way we will be able to observe that behavior on our side and think of possible solution.

    I'm looking forward to hearing from you.

    Regards,
    Kalin
    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
DevCraft banner