Quantcast
Channel: AvalonDock
Viewing all articles
Browse latest Browse all 2690

New Post: Exception Nested DockingManager's Using Prism....

$
0
0
I am trying to do something similar, I think. I have a docking manager in the main window and that docking manager contains anchorables that also contain docking managers of their own. I am not sure that your problem is the same that I had, but here is how I managed to get mine to be able to serialise and de-serialise:

I force the views to actually display all anchorables before serialising. Also, after de-serialising the docking manager of the main window, I do this again before de-serializing the anchorables within.

I think that this is a rather ugly solution, but it appears to work. What I do is iterate through all the anchorables in the docking manager of the main window, make them active and force them to update their layout:
        protected void forceViews()
        {
            // Force intantiation of views for the AvalonDockingManager so that
            // loading of the layout from MainWindowViewModel will work at start-up:
            foreach (object o in _workspacesDockingManager.AnchorablesSource)
            {
                _workspacesDockingManager.ActiveContent = o;
                _workspacesDockingManager.UpdateLayout();
            }
            // Activate the first anchorable:
            IEnumerator i = _workspacesDockingManager.AnchorablesSource.GetEnumerator();
            i.MoveNext();
            _workspacesDockingManager.ActiveContent = i.Current;
        }
The ugly part here is that this code lives in my view model and _workspacesDockingManager is a reference to a part of the view.

If anyone has a better solution, I'd be happy to hear it.

Viewing all articles
Browse latest Browse all 2690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>