This is a migrated thread and some comments may be shown as answers.

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

9 Answers 381 Views
Docking
This is a migrated thread and some comments may be shown as answers.
ION TRADING SRL
Top achievements
Rank 1
ION TRADING SRL asked on 29 Jul 2011, 02:14 PM
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.

9 Answers, 1 is accepted

Sort by
0
Neil
Top achievements
Rank 1
answered on 29 Jul 2011, 03:12 PM
+1. We're using the RAD Ribbon and double clicking makes a RadPane maximise over the ribbon. Not cool! How to work around?
0
Miroslav Nedyalkov
Telerik team
answered on 02 Aug 2011, 12:55 PM
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 >>

0
bg
Top achievements
Rank 1
answered on 31 Aug 2011, 09:07 PM
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.
0
bg
Top achievements
Rank 1
answered on 31 Aug 2011, 09:28 PM
Update: setting toolWindow.MaxHeight and toolWindow.MaxWidth will lock the pane in an unusable state when double clicking on the header.
0
Miroslav Nedyalkov
Telerik team
answered on 01 Sep 2011, 08:21 AM
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 >>

0
Beijerinc
Top achievements
Rank 1
answered on 06 Dec 2011, 04:46 PM
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.
0
Miroslav Nedyalkov
Telerik team
answered on 09 Dec 2011, 10:49 AM
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 >>

0
Beijerinc
Top achievements
Rank 1
answered on 09 Dec 2011, 11:23 AM
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
0
Miroslav Nedyalkov
Telerik team
answered on 09 Dec 2011, 01:59 PM
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 >>

Tags
Docking
Asked by
ION TRADING SRL
Top achievements
Rank 1
Answers by
Neil
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
bg
Top achievements
Rank 1
Beijerinc
Top achievements
Rank 1
Share this question
or