hello, i have a UltraDockManager1. I add some panes in run time. panes are right dock
if i close them and click a button (see mi code) the pane i shows again because the pane already exists (UltraDockManager1.DockAreas(0).Panes.count still have 1, that means the pane has no been deleted).
but if i made the dockArea floating and then close the pane AND then click the button, my condition If Not ....DockAreas(0).Panes.Exists(".... then says that the pane no exist. UltraDockManager1.DockAreas(0).Panes.count have a value=0. but when it try to add the pane ( UltraDockManager1.DockAreas(0).Panes.Add(pane) ) an error is throw and says that key already exists but as i said Panes.Exists and Panes.count says that ther are no panes.
the question: is this a bug? o em i doing something wrong?
ps: sorry for my english :P
Private Sub UltraToolbarsManager1_ToolClick(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs) Handles UltraToolbarsManager1.ToolClick
Select Case e.Tool.Key
Case "btn_informacionGeneral"
UltraDockManager1.Visible = True
If Not UltraDockManager1.DockAreas(0).Panes.Exists("informacionGeneral") Then
Dim Uc_informacionGeneral1 As New uc_informacionGeneral
Dim pane As New Infragistics.Win.UltraWinDock.DockableControlPane("informacionGeneral", "Información general del hotel", Uc_informacionGeneral1)
UltraDockManager1.DockAreas(0).Panes.Add(pane)
Else
UltraDockManager1.DockAreas(0).Panes("informacionGeneral").Show()
End If
UltraDockManager1.DockAreas(0).Panes("informacionGeneral").Activate()
End Select
End Sub
I am totally confused about removing panes (not closing). I need the ability to create panes and at times completely remove them. I have ready various suggestions like using .Remove(mypane) or .Pane.Dispose() or .Pane.Control = null or .Pane.Control.Dispose() or maybe a combination of them all. I also read where UltraDockManager will lazely scavange for empty panes.
I can never seem to get the panes to be completely removed from the collection and properly cleaned up so I can later add a new pane with the same key as one that was dipsosed or removed before.
Can you help? This seems to be a HUGE issue with UltraDockManager an it is causing me fits.
Thanks!!
You can iterate the ControlPanes collection or use one of the other PaneFrom... methods.
but ultraDockManager.PaneFromKey return null. How can i check it another way?
and when I Add pane I get "key already exists"
Closing a pane just means hiding it. It does not actually remove the pane form the ControlPanes collection. When you float a pane, it is removed from it's DockAreaPane and placed in a floating one instead. That's why your code shows that the count is zero. You can run your code when the pane is still floating and open and the count of that first DockAreaPane will still be 0. So when you add the pane again, you are getting a "key already exists" error because the original pane is still in the ControlPanes collection. That is the collection you should be checking to see if the pane exists.
Have you solve the problem?
I think I have the same one.