How to disable ToolWindow floating after double click header

10 posts, 0 answers
  1. kj
    kj avatar
    12 posts
    Member since:
    Jun 2010

    Posted 25 Aug 2010 Link to this post

    Hi,

    If I double click the header of Toolwindow, it will become floating. May this function be closed? Thanks.
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 25 Aug 2010 Link to this post

    Hi, 

    If you mean you only want to be able to resize, autohide and pin, then this should do it for you. Add to FormLoad (for example)

    Me.ToolWindow1.AllowedDockState = Telerik.WinControls.UI.Docking.AllowedDockState.All And Not Telerik.WinControls.UI.Docking.AllowedDockState.Floating
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 30 Aug 2010 Link to this post

    Hello guys,

    Richard, thank you for your assistance.

    KJ, please let us know if this solution is suitable for your scenario or if you are after different behavior.

    Regards,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. kj
    kj avatar
    12 posts
    Member since:
    Jun 2010

    Posted 01 Sep 2010 Link to this post

    Thanks for your reply, Richard. But it is not my problem.

    Please refer to following online help, I want to cancel the function of
    mouse support.

    http://www.telerik.com/help/winforms/dock_usabilitykeyboardsupport.html

    Mouse support:
    Double click: Double-clicking the title bar of a ToolWindow un-docks the panel so that it
    floats. Double-clicking the title bar of a floating ToolWindow docks the ToolWindow.

    Besides, if I right-click on the header of  ToolWIndow, the contextmenu with option for docking or floatong will appear, can this be close? Thanks for your reply.
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Sep 2010 Link to this post

    Tried to upload a sample project for you but not allowed here. 
    This could should help


    Private Sub Form_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load
     
        ' Tool window properties
        Me.ToolWindow1.DocumentButtons = Telerik.WinControls.UI.Docking.DocumentStripButtons.None
        Me.ToolWindow1.ToolCaptionButtons = Telerik.WinControls.UI.Docking.ToolStripCaptionButtons.AutoHide
     
        ' Document window properties
        Me.DocumentWindow1.DocumentButtons = Telerik.WinControls.UI.Docking.DocumentStripButtons.None
        Me.DocumentWindow1.ToolCaptionButtons = Telerik.WinControls.UI.Docking.ToolStripCaptionButtons.None
     
        ' Tell the Tool Window it may not float or be a tabbed document
        Me.ToolWindow1.AllowedDockState = Telerik.WinControls.UI.Docking.AllowedDockState.All And _
            Not Telerik.WinControls.UI.Docking.AllowedDockState.Floating And _
            Not Telerik.WinControls.UI.Docking.AllowedDockState.TabbedDocument
    End Sub


    Richard
  7. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 13 Sep 2010 Link to this post

    Hello guys

    KJ, if I understand your requrement correctly, you want to remove only the double-click support, but you still want to be able to float a window by a mouse drag operation. If this is the case, please refer to the code snippet below. Basically, you need to handle the TransactionCommitting event and check which is the reason for the transaction. In addition, you can prevent the context menu from appearing by handling the ContextMenuDisplaying event of the ContextMenuService:
        public Form1()
        {
            InitializeComponent();
      
            ContextMenuService menuService = this.radDock1.GetService<ContextMenuService>();
            menuService.ContextMenuDisplaying += menuService_ContextMenuDisplaying;
      
            this.radDock1.TransactionCommitting += new RadDockTransactionCancelEventHandler(radDock1_TransactionCommitting);
        }
      
        void radDock1_TransactionCommitting(object sender, RadDockTransactionCancelEventArgs e)
        {
            RedockTransaction transaction = e.Transaction as RedockTransaction;
            if (transaction != null)
            {
                if (transaction.Reason == RedockTransactionReason.ToolTabStripCaptionDoubleClick 
                    || transaction.Reason == RedockTransactionReason.FloatingWindowCaptionDoubleClick)
                {
                    e.Cancel = true;
                }
            }
        }
      
        private void menuService_ContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
        {
            if (e.DockWindow is ToolWindow)
            {
                e.Cancel = true;
            }            
        
    }

    I hope this helps.

    Best Regards,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Abhishek
    Abhishek avatar
    3 posts
    Member since:
    Apr 2011

    Posted 06 May 2011 Link to this post

    On a related note, I would like to mention that there is an issue with floating toolwindows not returning to their previous state on double-click of their headers if the previous state was a "tabbedDocument".

    Steps to reproduce :

    1. Dock Fill a toolwindow to have a tabbed document.
    2. Right-click the tabbed document and select Floating option (I would rather prefer if this also could be achieved by double-clicking on the header of tabbeddocument).
    3. Now you have a floating toolwindow, double-click on its header and it should go back to its previous state which was a "tabbedDocument" (or DockFill), but this doesn't happen and the toolwindow gets left docked on the form.

    Please help with this.

    Thanks
    Abhishek Dudeja
  9. Per D. H. Pasgaard
    Per D. H. Pasgaard avatar
    6 posts
    Member since:
    Aug 2009

    Posted 10 May 2011 Link to this post

    I have the exact same problem. A double-click on a floating window always default to a LeftDock.
  10. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 11 May 2011 Link to this post

    Hello guys,

    The behavior that you experience is the designed behavior of RadDock - floating windows can only become docked ToolWindows by the double click operation. I have added your requirement as a feature request in our PITS.

    Despite the fact that there is no straightforward solution, I think that you can achieve the desired behavior by handling two events: DockStateChanging and TransactionCommitting. I am attaching a sample project that demonstrates the approach.

    I hope this helps.

    All the best,
    Nikolay
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  11. Yuk Hei
    Yuk Hei avatar
    5 posts
    Member since:
    Nov 2014

    Posted 26 Feb 2015 in reply to Nikolay Link to this post

    void radDock1_TransactionCommitting(object sender, RadDockTransactionCancelEventArgs e)
        {
            RedockTransaction transaction = e.Transaction as RedockTransaction;
            if (transaction != null)
            {
                if (transaction.Reason == RedockTransactionReason.ToolTabStripCaptionDoubleClick
                    || transaction.Reason == RedockTransactionReason.FloatingWindowCaptionDoubleClick)
                {
                    e.Cancel = true;
                }
            }
        }


    when i double click the tool window, it seems the transaction is null?
    what is the problem on it?
Back to Top
UI for WinForms is Visual Studio 2017 Ready