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

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

8 Answers 190 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 1
Grant asked on 26 Dec 2011, 06:37 PM
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!

8 Answers, 1 is accepted

Sort by
0
Grant
Top achievements
Rank 1
answered on 28 Dec 2011, 09:22 PM
Anyone know how to disable closing / reordering tabs in a DocumentContainer control, inside a RadDock?
0
Stefan
Telerik team
answered on 29 Dec 2011, 03:03 PM
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.
0
Grant
Top achievements
Rank 1
answered on 29 Dec 2011, 07:40 PM
You're solutions were exactly what I needed. Thanks for the great support Stefan!  
0
Stefan
Telerik team
answered on 30 Dec 2011, 03:39 PM
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).
0
Faraz
Top achievements
Rank 1
answered on 06 Jul 2018, 03:59 AM

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

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Jul 2018, 08:37 AM
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.
0
Faraz
Top achievements
Rank 1
answered on 06 Jul 2018, 09:06 AM

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 .

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Jul 2018, 09:50 AM
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.
Tags
PageView
Asked by
Grant
Top achievements
Rank 1
Answers by
Grant
Top achievements
Rank 1
Stefan
Telerik team
Faraz
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or