Double-clicking on the window header maximizes the pane instead of dock it

10 posts, 0 answers
  1. ION TRADING SRL
    ION TRADING SRL avatar
    1 posts
    Member since:
    Jun 2011

    Posted 29 Jul 2011 Link to this post

    Hi,
    We observe that double-clicking on a floating RadPane maximizes the floating window, making it to cover all the docking area and going outside the DockingManager control bounds, like a "desktop" window.
    It is possible to disable this behavior using the API?

    In Visual Studio 2010 this feature can be useful in a multi-monitor scenario, since the floating window will maximize it inside the current monitor. However as opposite, in a browser environment this behavior can be frustrating.

    In addition, it is possible to undock a component (or tab of components) directly double-clicking on their captions?

    Thank you,
     A.
  2. Neil
    Neil avatar
    10 posts
    Member since:
    Apr 2011

    Posted 29 Jul 2011 Link to this post

    +1. We're using the RAD Ribbon and double clicking makes a RadPane maximise over the ribbon. Not cool! How to work around?
  3. DevCraft banner
  4. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 02 Aug 2011 Link to this post

    Hi Everybody,

     This new feature we added currently cannot be switched off. As you correctly noticed we are using Visual Studio 2010 as an example of how the Docking control should behave.
    We will consider your request for a way to switch the feature off using the API.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  5. bg
    bg avatar
    19 posts
    Member since:
    Jul 2006

    Posted 31 Aug 2011 Link to this post

    I agree that this is not something that I want to have in the pane functionality since it covers up my ribbon bar when maximized.

    I have a work around:

    Handle the RadDocking PaneStateChange Event and add the following:

    private void radDocking_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                foreach (RadPane pane in radDocking.Panes)
                {
                    if (pane != null && pane.IsFloating)
                    {
                        INotifyLayoutChange window = GetToolWindowNLC(pane);
     
                        if (window != null)
                        {
                            window.LayoutChangeEnded += new EventHandler(window_LayoutChangeEnded);
                        }
                    }
                }
            }
     
    private INotifyLayoutChange GetToolWindowNLC(RadPane pane)
            {
                ToolWindow window = pane.ParentOfType<ToolWindow>();
     
                if (window == null)
                {
                    return (((pane.Parent as RadPaneGroup).Parent as RadSplitContainer).Parent) as INotifyLayoutChange;
                }
     
                return window as INotifyLayoutChange;
            }

    In the Window LayoutChangeEnded handle the size and reset it causing the pane to go back to its original size.

    void window_LayoutChangeEnded(object sender, EventArgs e)
            {
                ToolWindow window = (ToolWindow)sender;
     
                if (window.ActualHeight > this.radDocking.ActualHeight)
                    window.Height = this.radDocking.ActualHeight - 5;
     
                if (window.ActualWidth > this.radDocking.ActualWidth)
                    window.Width = this.radDocking.ActualWidth - 5;
    }
    This is working for me, but not perfectly. The issue I have is that if the user clicks several time on the window this code if not fired fast enough.
    Hopefully Telerik will have an option to disable this functionality in the V-Next build.
  6. bg
    bg avatar
    19 posts
    Member since:
    Jul 2006

    Posted 31 Aug 2011 Link to this post

    Update: setting toolWindow.MaxHeight and toolWindow.MaxWidth will lock the pane in an unusable state when double clicking on the header.
  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 01 Sep 2011 Link to this post

    Hi Bg,

     Thank you for sharing us about this problem. I logged it in PITS. The item is about the RadWindow control as they share common codebase with the Docking ToolWindows.

    Best wishes,
    Miroslav Nedyalkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  8. Beijerinc
    Beijerinc avatar
    19 posts
    Member since:
    Feb 2011

    Posted 06 Dec 2011 Link to this post

    Hello,

    I have a menu and taskbar on a page with a RadDocking in the center. I need to restrict the size and positioning of the ToolWindows created by the RadDocking. So far, I am able to do that using the following code (in a custom ToolWindow):
    protected override void UpdatePositionHelper(PositionHelper helper)
    {
        Point restrictionLocation;
        Size restrictionSize;
     
        // Restrict the window by its parent RadDocking.
        if ( IsBoundByParent )
        {
            RadDocking parentDocking = this.GetParentDocking();
            GeneralTransform transform = parentDocking.TransformToVisual( null );
     
            restrictionLocation = transform.Transform( new Point( 0, 0 ) );
            restrictionSize = new Size( parentDocking.ActualWidth, parentDocking.ActualHeight );
        }
        // Restrict the window by the application.
        else
        {
            restrictionLocation = new Point( 0, 0 );
            restrictionSize = new Size( Application.Current.Host.Content.ActualWidth,
                                            Application.Current.Host.Content.ActualHeight );
        }
     
        // Restrict the window size when maximized.
        MaxWidth = restrictionSize.Width;
        MaxHeight = restrictionSize.Height;
     
        // Restrict the window location and size when not maximized.
        helper.UpdatePropertiesDependantOnWindow( restrictionLocation, restrictionSize, IsRestricted, new Thickness( 0 ) );
    }

    The only problem I am still having is the problem mentioned by Bg; when setting the MaxHeight, the maximized window is not responding to double clicks that would normally restore the window to windowed mode. This behavior appears to be limited to setting the MaxHeight property. I hope you are not catching the double click in an area at the top of the screen instead of on the control itself...

    I have seen the issue in PITS, but as it does not appear to be fixed any time soon, would anyone be able to provide some additional information on why this problem may occur and how I can work around it (for the time being)? Perhaps a short description on how the mouse events are handled in the WindowBase?

    Kind regards,
    Beijerinc

    PS: If I drag and then rapidly click a ToolWindow, it is maximized. When dragging, the double click feature should be disabled.
  9. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 09 Dec 2011 Link to this post

    Hello Beijerinc,

    We added a new feature to the Docking control that allows to set RestrictedAreaMargin and IsRestricted properties of the Docking control which restricts all of its child ToolWindows. It works the same ways the feature of the similar feature of the RadWindow control.

    Hope this helps.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  10. Beijerinc
    Beijerinc avatar
    19 posts
    Member since:
    Feb 2011

    Posted 09 Dec 2011 Link to this post

    Hello Miroslav Nedyalkov,

    I have had a look at this feature just now, but it does not solve my problem. I am able to restrict the position and size of the window to an area, but a maximized window still covers the entire screen.

    By the way, perhaps there should not be an "IsRestricted" property, but an "IsRestrictedTo" with an enumeration allowing developers to restrict to nothing, the application / plugin or the docking control. I find it strange that there is no way to restrict windows to their docking host without manually setting a margin. It is probably not that hard, seeing as you already have the code to restrict to a margin. The only missing link is to calculate the margin for a docking host (using this.TransformToVisual(null) as position and ActualWidth, ActualHeight for dimensions).
    public enum RestrictTo
    {
        // Restricts floating windows to nothing, although the location the mouse grabs the window will restrict the window from leaving the screen completely (which is already the case, score 1 for Telerik).
        Nothing,
        // Restricts floating windows to the plugin. A window will always be completely visible inside the plugin area.
        Application,
        // Restricts floating windows to the parent docking control's area. Maximized windows cover the entire plugin.
        ParentDockingAsFloating,
        // Restricts floating windows to the parent docking control's area. Maximized windows cover only the parent docking control's area.
        ParentDockingAsMaximized,
        // Restricts floating windows to a predefined margin within the plugin. Maximized windows cover the entire plugin.
        MarginAsFloating,
        // Restricts floating windows to a predefined margin within the plugin. Maximized windows cover only the predefined margin area.
        MarginAsMaximized
    }

    Anyways, would you be so kind as to ellaborate on my first post? Why is the double click not functioning and / or how can I work around it?

    Kind regards,
    Beijerinc
  11. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 09 Dec 2011 Link to this post

    Hello Beijerinc,

    Thank you for your suggestion - we will consider it when planning changes on the Docking control.

    The header area of the window is not acting correctly when you set MaxHeight of the window and maximize it, because the window is actually placed in a WindowPresenter, which is generally a Content presenter which handles mouse down, double click, drag, resize etc. and the MaxHeight is not set to this presenter as well which is an issue and I logged it in PITS. Thank you reporting us this issue.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner