Hi there,
I implemented the XamDockManger with my ViewModel, as described in one of your Blogs and it works like a charm (http://ko.infragistics.com/community/blogs/blagunas/archive/2013/09/24/xamdockmanager-data-binding-contentpanes-with-mvvm.aspx).
But now I’m facing a problem when I want so save and reload the current layout, because after loading the layout the TagGroupPane with its behavior will not be recreated like I defined it before. This mean that no new added Items to my ItemsSource will be added to the XamDockManager anymore.
I think this happens because the load-event takes my existing panes and add them to a new TagGroupPane, because I haven’t set a Name to my TagGroupPane w/ behavior. But as soon I add a Name to one of my DocumentPane, SplitPane or TagGroup I get an exception that “An item with the same key has already been added” while trying to load the layout.
But as far as I can see the above blog-example shows a way where only one TagGroupPane have and should have the ItemSourceBehaivor, otherwise every TagGroupPane will add the new Item to his own panes.
So now I’m trying to archive an implementation of the XamDockManger with DataBinding its ContentPane to one main TagGroupPane and the ability to save and load my configuration and still have the CollectionChanged handling after I did my loading.
I created a small example and some use-cases:
Rearrange the panes, add new => new tab is shown
Rearrange the panes, save layout, load layout, add new => new tab is not shown
Rearrange the panes, save layout, add new, load layout, add new => old TagGroupPane w/behavior will be “added” and all other (new and old) panes will be also displayed in it + adding new panes still works
Rearrange the panes, save layout, restart app, add new, load layout => old TagGroupPane w/behavior will be “added” and only the new panes will be displayed in it + adding new panes still works
BR
Andreas Hensel
Hi Andreas,
The main reason why the behavior stops working after a LoadLayout is because the TabGroupPane was replaced. Since the behavior is still on the old one and has not been moved to the new TabGroupPane, the add button doesn't show a new pane. I thought maybe you could give the TabGroupPane a name so that it would be reused by the XamDockManager but it looks like this just causes another exception based on the pane location. I'm currently looking into this to see if I can get it working. I'll let you know once I have something.
Hi Rob,
Thanks for your quick response and looking into it. And it’s good to know that my first assumption of this behavior was sort of right.
At this point I’m also quite open for a code-behind based solution :)
Andreas