Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
535
Data Binding ContentPanes with MVVM and Save/LoadLayout
posted

Hi there,

 

I implemented the XamDockManger with my ViewModel, as described in one of your Blogs and it works like a charm (http://es.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:

  1. Rearrange the panes, add new => new tab is shown

  2. Rearrange the panes, save layout, load layout, add new => new tab is not shown

  3. 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

  4. 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

XamDockManagerTesting_01.zip