Hi,
How do I hide the 'x' (close) on the top/right side of a docked window tab?
(See screenshot)
Thanks,
-Lou
8 Answers, 1 is accepted
Thank you for writing.
You can hide the close button for all DocumentWIndows by setting the RadDock.ShowDocumentCloseButton property to false.
Regards,
Dess
Telerik
Thanks for the reply, Dess. I need to hide the 'x' on only one particular DocumentWindow (not all of them). Is there a way to do that?
-LouThank you for writing back.
In order to hide the close button for a specific DocumentWindow, you can access the desired TabStripItem and set its ShowCloseButton property to false:
TabStripItem item =
this
.documentTabStrip1.TabStripElement.Items[1]
as
TabStripItem;
item.ShowCloseButton =
false
;
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik
Thanks, that worked !
-Lou
Hi. I tried a similar thing using the code below and it works to hide the close button, but I also noticed that it causes an exception if you switch between tabs. Is there something I'm missing? The code below runs in my form_load method.
for (int i = 0; i <= 2; i++)
{
item = radDocumentTabStrip_history.TabStripElement.Items[i] as TabStripItem;
item.ShowCloseButton = false;
}
From the error message, it looks like a tab is being disposed of and then isn't there when it needs to be re-opened. Any ideas what can be causing this?
Steve
Thank you for writing.
I am not sure what is the complete scenario that reproduces the issue. However, if the CloseAction property for the available DockWindows is set to CloseAndDispose this window is closed and then disposed and if you try to access it is possible to encounter an error. Please refer to the Removing ToolWindow and DocumentWindow at Runtime help article.
If you are still experiencing any further difficulties, it would be greatly appreciated if you specify the exact steps how to reproduce the problem or get back to me with a sample code snippet replicating the issue so I can investigate the precise case. Thank you in advance.
I hope this information helps. Should you have further questions, I would be glad to help.
Dess
Telerik
This is not working for me.
// Disable close button in dock windows
CaseViewV2Dock.ShowDocumentCloseButton = false;
CaseViewV2Dock.ShowToolCloseButton = false;
I've tried various option in the UI too.See attachments
Hello, Ronald,
Note that the ShowDocumentCloseButton property controls the visibility of the close button displayed in each tab:
Each document windows has it own buttons configuration. So you can disable the close button for all document windows using the code snippet below:
foreach (DockWindow item in this.radDock1.DockWindows)
{
if (item is DocumentWindow)
{
item.DocumentButtons = DocumentStripButtons.ActiveWindowList;
}
}
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik