Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > PageView > Prevent rearranging tabs / closing document windows in a DocumentContainer control.

Not answered Prevent rearranging tabs / closing document windows in a DocumentContainer control.

Feed from this thread
  • Grant avatar

    Posted on Dec 26, 2011 (permalink)

    I added a DocumentContainer control with multiple DocumentWindows at design time, and I'd like to prevent closing or reordering the document windows.

    So far, I set the DocumentButtons property to None, and I found a post on here to disable the right-click context menu.

    However, in testing, users could still click the tab with their third mouse button / clickable scroll wheel and close a document window; I need to prevent this. Also, how do I prevent users from dragging tabs around to rearrange their order? I'd like to keep them in the order I chose at design time.

    Thanks to anyone with an answer!

    Reply

  • Grant avatar

    Posted on Dec 28, 2011 (permalink)

    Anyone know how to disable closing / reordering tabs in a DocumentContainer control, inside a RadDock?

    Reply

  • Stefan Stefan admin's avatar

    Posted on Dec 29, 2011 (permalink)

    Hi Grant,

    Thank you for writing.

    I am getting straight to your questions:
    1. How to prevent users from closing DocumentWindow.
    You can do that by subscribing to the DockWindowClosing event of RadDock and cancel the operation if the window that is being close is of type DocumentWindow:
    void radDock1_DockWindowClosing(object sender, Telerik.WinControls.UI.Docking.DockWindowCancelEventArgs e)
    {
        if (e.NewWindow is DocumentWindow)
        {
            e.Cancel = true;
        }
    }

    2. Is there a way to prevent users from dragging tabs around to rearrange their order? 
    Yes there is. To prevent the different docking operations, simply stop the DragDropService and to prevent the items from being rearranged set the ItemDragMode of the TabStripElement to None:
    DragDropService service = this.radDock1.GetService<DragDropService>();
    service.Enabled = false;

    documentTabStrip1.TabStripElement.ItemDragMode = Telerik.WinControls.UI.PageViewItemDragMode.None;

    I hope that the provided information addresses your questions. Should you have any other questions, do not hesitate to contact us.
     
    All the best,
    Stefan
    the Telerik teamQ3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

    Reply

  • Grant avatar

    Posted on Dec 29, 2011 (permalink)

    You're solutions were exactly what I needed. Thanks for the great support Stefan!  

    Reply

  • Stefan Stefan admin's avatar

    Posted on Dec 30, 2011 (permalink)

    Hello Grant,

    I am glad that I could help. If there is anything else we can assist you with, do not hesitate to contact us.
     
    All the best,
    Stefan
    the Telerik teamSP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > PageView > Prevent rearranging tabs / closing document windows in a DocumentContainer control.