Hello,
I am using 2009.2 and programmatically adding new content pane to the dock manager via AddDocument method.
I would like to know the best way to avoid creating duplicate pane with same header. i.e., I have a list box with 3 items and have 3 corresponding document content panes. Now when reselecting an item in the list box, I would like to activate the already opened pane (irrespective of it is docked or floating, etc.,) instead of creating a new one.
Please clarify on how to implement this request
Thanks,
Muthu
It appears that below routine works, but is the approach or any direct APIs avilable on dockManager to identify if cotentpane of the given header exists or not?
foreach (var pane in dockManager.GetPanes(Infragistics.Windows.DockManager.PaneNavigationOrder.ActivationOrder)) { if (pane.Header.Equals(header)) { paneExists = true; pane.Activate(); break; } }
if (!paneExists) { var recordDisplayPane = dockManager.AddDocument(header, grid); recordDisplayPane.Activate(); }
That would be the way to do this or you could maintain your own table of information (e.g. a dictionary of header to contentpane that you add to as you create panes and remove as panes are removed). The xamDockManager itself cannot make any assumption that the header or any other property (except maybe the Name) can be used to uniquely identify a contentpane.