I am in the process of building a RegionAdapter (Prism) for the xamDockManager TabGroupPane control.
To add Document Content internally I am using the following:
ContentPane newContentPane = _xamDockManager.AddDocument(item.ToString(), item); newContentPane.Activate();
TabGroupPanes can be empty initially.
When having only 1 TabGroupPane the RegionAdatper works fine (it adds the document to that TabGroupPane).
When having more than 1 TabGroupPane I am looking for a way to specify to which TabGroupPane the region content should be added.
I notice by the sample provided in the xamFeatureBrowser, that is the TabGroupPane that holds the active contentPane. But in this case I need other way to specify the active TabGroupPane.
Any idea ?
The AddDocument method is just a helper method for creating a ContentPane in the "active" TabGroupPane similar to how creating a new document/file in VS will add that document/file to the tab group that contains the active pane. If you need to add a pane to a specific TabGroupPane then you could just add the item directly to the Items collection of that TabGroupPane . How you do that would really depend on how you created your app. If you created the TabGroupPane in the xaml at design time then VS would have generated a member variable for any named elements so you can just name the TabGroupPane and use that to reference it later. If you're creating it in code then you'll need to manage the reference to the TabGroupPane. Note, if you are creating it in code and want to ensure it remains in the tree, you should set the Name property. Unnamed Split/TabGroup panes could be removed when they are no longer needed.
Is it possible for me to create an ObservableCollection obj which could be used as something like myTabGrpPane.Items = myObservColl; so that as and when items are added / removed from collections contentPanes would be added/removed from TabGroup pane?
I am using MVVM and just like when i add items to a TabControl it would show new tabs for each item, i am hoping the TabGrouppane would do the same..
Basically the ItemsSource cannot be used in the TabGroupPane because the end user can drag the pane to other locations in which case it cannot exist within the Items collection.You would have to write your own attached behavior to add the pane to the DockManager/TabGroupPane and take into account that when the item is removed from the source collection that the pane may not be in the tabgrouppane and have to locate it and remove it from the dockmanager where it may be. I'll try to post a sample of how to do such a thing in the XDM next week. Note, you could use the NCAL layer with Prism and add to the XDM as you would add to other regions.