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

How do I remove the close button from a RadDock documentwindow

9 Answers 515 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Carol Ladson
Top achievements
Rank 1
Carol Ladson asked on 21 Jan 2010, 03:39 PM
I thought this code would remove the close button from a documentwindow that is in a RadDock object.   It did not.   How do I remove the close button from the documentwindow?

Code Snippet:
     this.documentWindow1.ToolCaptionButtons &= ~Telerik.WinControls.UI.Docking.ToolStripCaptionButtons.Close;

9 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 26 Jan 2010, 02:28 PM
Hi Carol Ladson,

The ToolCaptionButtons property is relevant to ToolWindows. However, if you want to set the available buttons of a DocumentWindow, please use the DocumentButtons property:
this.documentWindow1.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtos.Close;

I hope this helps. If you have additional questions, feel free to contact me.

All the best,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Julien
Top achievements
Rank 1
answered on 05 Feb 2010, 08:20 PM
Ok and how do we remove the close button when the tool is floating?
0
Nikolay
Telerik team
answered on 09 Feb 2010, 12:56 PM
Hello Julien,

You can remove the close button of the floating window dynamically on the TransactionCommitted event:
public Form1()
{
    InitializeComponent();
  
    this.radDock1.TransactionCommitted += new Telerik.WinControls.UI.Docking.RadDockTransactionEventHandler(radDock1_TransactionCommitted);
}
  
void radDock1_TransactionCommitted(object sender, Telerik.WinControls.UI.Docking.RadDockTransactionEventArgs e)
{
    if (e.Transaction.AssociatedWindows[0].FloatingParent != null)
    {
        e.Transaction.AssociatedWindows[0].FloatingParent.ControlBox = false;
        e.Transaction.AssociatedWindows[0].FloatingParent.FormBorderStyle = FormBorderStyle.FixedSingle;
    }
}

Greetings,
Nikolay
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Daryl
Top achievements
Rank 1
answered on 16 Feb 2011, 10:35 PM
I used this as stated and I still see an the close widget 

BTW this works for a DocumentWindow, but this is a ToolWindow....

 x_DOCK_PALETTE.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;

Did I type something wrong?
0
Richard Slade
Top achievements
Rank 2
answered on 17 Feb 2011, 10:32 AM
Hello Daryl,

If I understand correctly, you want to remove buttons from a ToolWindow when it is added to the RadDock. If that's correct, you can set the ToolStripCaptionsButtons. Either through the designer, in load, or when the window is added to the RadDock as below

private void radDock1_DockWindowAdded(object sender, DockWindowEventArgs e)
{
    if (radDock1.ActiveWindow is ToolWindow)
    {
        ToolWindow window = (ToolWindow)radDock1.ActiveWindow;
        window.ToolCaptionButtons = ToolStripCaptionButtons.AutoHide & ToolStripCaptionButtons.SystemMenu;
    }
}

Hope that helps
Richard
0
Daryl
Top achievements
Rank 1
answered on 17 Feb 2011, 05:19 PM
Richard - you understood correctly.  My mistake for not seeing the separate "ToolStripCaptionButtons" property.  The code below worked great!  Thanks!

 
x_DOCK_PALETTE.ToolCaptionButtons = ~ToolStripCaptionButtons.Close; 

 

 

 

 



 

0
Richard Slade
Top achievements
Rank 2
answered on 17 Feb 2011, 05:27 PM
Glad that helped.
All the best
Richard
0
Tino
Top achievements
Rank 1
answered on 11 Feb 2018, 10:34 PM

7 years on, but this came up in my search results and didn't work for me.

I think

if (radDock1.ActiveWindow is ToolWindow)

should be

if (e.DockWindow is ToolWindow)

otherwise the code applies to the same tool window every time. At least in the latest version.

0
Hristo
Telerik team
answered on 12 Feb 2018, 02:51 PM
Hello Tino,

Indeed, you are correct. The dock window can be retrieved from the event arguments. Thank you for updating the thread.

Let me know if you have other questions.

Regards,
Hristo
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
Dock
Asked by
Carol Ladson
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Julien
Top achievements
Rank 1
Daryl
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Tino
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or