Hi,Now I have a tabcontrol as a top menu, I want to add a new feature to the tabcontrol, Double-click the tab to hide the TabPage,my initial design was to double-click the Tab to make the height of the Tabpage become 0 to hide the TabPage.But now I dockeded the tabControl to the top by UltraDockManager, I can't hide DockArea.How can I achieve this?
Hello Stan,
Thank you for the provided code snippet. Based on it I created a sample application which hides only the TabPage when it's double-clicked on the TabHeader. I have attached the sample below. Please test it on your side and let me know if this is an accurate demonstration of what you require. If it is not, please feel free to modify it and send it back to me along with steps to reproduce.
Thank you for your cooperation.
Looking forward to hearing from you.
Sincerely,
Teodosia Hristodorova
Associate Software Developer
3107.Hide_TabPage_CAS-205505-W5C0Q0.zip
Hello Teodosia ,
Thanks for your reply.
I just want to hide the TabPage in the TabControl, TabHeaderArea keeps showing.
If I make ultraDockManager1.ControlPanes close, the entire Tab will be hidden.
This is my original code:
private void ultraTabControl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { UIElement uiEl = ultraTabControl1.UIElement.ElementFromPoint(e.Location); if (uiEl.Parent is TabItemUIElement t) { if (ultraTabControl1.TabPageSize.Height == 0) { ultraTabControl1.TabPageSize = new Size(ultraTabControl1.TabPageSize.Width, 150); } else { ultraTabControl1.TabPageSize = new Size(ultraTabControl1.TabPageSize.Width, 0); } } } }
My suggestion is to use the Closed property on the panes. When Closed is set to true, the pane will not be visible. When Closed is false the pane is visible.
Setting Closed to true sometimes causes the pane to be removed from the associated DockAreaPane, so you may need to add the pane to the DockAreaPane in that case. Panes could be hidden and shown easily using the Close and Show methods on the pane. For example, the following code could be used in order to hide a specific pane:
ultraDockManager1.ControlPanes["tabPane"].Close();
And this code when you want to show it:
ultraDockManager1.ControlPanes["tabPane"].Show();
Please let me know whether this works for you. If this is not an accurate demonstration of what you are trying to achieve please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach in in this case.
Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.
Sincerely,Teodosia HristodorovaAssociate Software Developer