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

9 posts, 0 answers
  1. Grant
    Grant avatar
    7 posts
    Member since:
    Oct 2009

    Posted 26 Dec 2011 Link to this post

    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!
  2. Grant
    Grant avatar
    7 posts
    Member since:
    Oct 2009

    Posted 28 Dec 2011 Link to this post

    Anyone know how to disable closing / reordering tabs in a DocumentContainer control, inside a RadDock?
  3. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 29 Dec 2011 Link to this post

    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.
  4. Grant
    Grant avatar
    7 posts
    Member since:
    Oct 2009

    Posted 29 Dec 2011 Link to this post

    You're solutions were exactly what I needed. Thanks for the great support Stefan!  
  5. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 30 Dec 2011 Link to this post

    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).
  6. Faraz
    Faraz avatar
    2 posts
    Member since:
    Feb 2017

    Posted 05 Jul 2018 Link to this post

    I added a DocumentContainer control with multiple DocumentWindows at design time, and I use tab strip to show all document window in multiline You can see code

    DocumentTabStrip tabStrip = container.Controls[0] as DocumentTabStrip;
                if (tabStrip != null)
                {
                    tabStrip.TabStripElement.ItemFitMode = StripViewItemFitMode.MultiLine;
                }

    So far When i click on document window tab that time all document window tabs rearrange the position i want fix position of all document window tab when i use tabs strip multiline.I attached the reference image please provide solution how i can do.

     

    When i Click option in tab strip (you can see in image # 1) all tab in arrange order but when i click Sys Monitoring (you can see in image # 2) so that tab shift to down .I want to fix the position please solve my issue. Thanks

     

  7. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3216 posts

    Posted 06 Jul 2018 Link to this post

    Hello, Faraz,   
     
    When you set to StripViewItemFitMode.MultiLine items are arranged in multi line layout. You can also set the MultiLineItemFitMode property to None or Reflow (default). If you set the MultiLineItemFitMode property to None you will manually need to set the Row property of the item. Note that RadDock uses internally a RadPageViewStripElement for the tabs. The following help article gives you an example: https://docs.telerik.com/devtools/winforms/pageview/stripview/fitting-items

    I hope this information helps. If you have any additional questions, please let me know. 
     
     
    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  8. Faraz
    Faraz avatar
    2 posts
    Member since:
    Feb 2017

    Posted 06 Jul 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello Dess,

     Thanks for reply.

    If i can use set the MultiLineItemFitModeproperty to None or Reflow (default) .Then all tabs show in one row or some tabs hide in row .

    That way i  set MultiLine row because i want  to show all tabs .

  9. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3216 posts

    Posted 09 Jul 2018 Link to this post

    Hello, Faraz,   

    The MultiLineItemFitMode takes effect when you set the RadPageViewStripElement.ItemFitMode property to StripViewItemFitMode.MultiLine. Thus, the items are arranged in multi line layout. After some further testing I have noticed that the tab items are re-positioned incorrectly when you click a certain tab. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

    I have also updated your Telerik points.

    Currently, the possible solution that I can suggest is to set the MultiLineItemFitMode property to None and specify the DocumentWindow.TabStripItem.Row property in order to arrange the tabs as you wish.

    this.documentTabStrip1.TabStripElement.ItemFitMode = StripViewItemFitMode.MultiLine;
    this.documentTabStrip1.TabStripElement.MultiLineItemFitMode = MultiLineItemFitMode.None;
    this.documentWindow4.TabStripItem.Row = 2;
    this.documentWindow7.TabStripItem.Row = 2;
    this.documentWindow1.TabStripItem.Row = 2;
    this.documentWindow5.TabStripItem.Row = 2;



    I hope this information helps. If you have any additional questions, please let me know. 
     
      
    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top