
I want to be able to control the closing of a toolwindow, so that it only closes when a menu item is clicked. i.e I want to disable closing of the tool window using the x button.
When I create a new ToolWindow, I set the toolWindow.CanClose = false.
Then right away, I call toolWindow.Undock(), so it appears undocked.
However, in the undocked state, the ToolWindow still displays the x button in the TitleBar, giving users the illusion that it can be closed. When you click on the x button, it does nothing because the CanClose property is set to false.
This is misleading. How can I get rid of the x button?
Alternatively:
I also tried setting ToolWindow.CanClose = true,
Then in the ToolWindow_Closing event I set
e.Cancel = true;
toolWindow.Hide();
This hides the control in the ToolWindow, but the form itself is still visible.
What is the right approach?
When I create a new ToolWindow, I set the toolWindow.CanClose = false.
Then right away, I call toolWindow.Undock(), so it appears undocked.
However, in the undocked state, the ToolWindow still displays the x button in the TitleBar, giving users the illusion that it can be closed. When you click on the x button, it does nothing because the CanClose property is set to false.
This is misleading. How can I get rid of the x button?
Alternatively:
I also tried setting ToolWindow.CanClose = true,
Then in the ToolWindow_Closing event I set
e.Cancel = true;
toolWindow.Hide();
This hides the control in the ToolWindow, but the form itself is still visible.
What is the right approach?