This project is read-only.

[Version 2.0] Exclude Layout items from serialization

Oct 24, 2012 at 5:04 PM

Is it possible to exlude layout items from serialization?

I dont want to have my LayoutDocuments serialized, is it possible to exclude them?

Currently, I simply modify the XML generated by the XmlLayoutSerializer and replace the LayoutDocumentPane node with <LayoutDocumentPane /> before I save it to disk, but I'm wondering if there is a simpler/cleaner solution.


Nov 8, 2012 at 6:40 AM

I also have similar requirement to avoid serialization of some AnchorablePanes. I think this is up to ILayOutUpdateStrategy. But do not know exactly how to do this.

Dec 5, 2012 at 2:26 AM

I also have the same problem I'm struggling to find a way not to serialise LayoutDocuments.

Dec 13, 2012 at 3:31 PM
Edited Dec 13, 2012 at 3:43 PM

I have the same issue.

I need a way NOT to open documents at the beginning. Even if there were some opened when I serialized my layout the last time.

Also I have a basic plugin system where plugins add anchorables at the initialization. There are cases where I load the layout with different plugins and I wouldn't want dummy panels to be opened for not loaded plugins.

Basically I have two ObservableCollections for the AnchorablesSource and the DocumentsSource. I want to only see the anchorables currently present in those collections, but have them on loadlayout where they were on the last save.

Is there a way to achieve this behaviour?

Jul 11, 2013 at 10:46 PM
I had same problem and did this hack to resolve the issue.

It's just a hack reading/writing the xml file to remove LayoutDocuments but there seems no other method to prevent from serializing LayoutDocuments for now.

Hope this helps some.
            var serializer = new XmlLayoutSerializer(dockManager);
            //this is a hack

        private void DeleteLayoutDocument(string avalondockConfig)
            XmlDocument configDoc = new XmlDocument();
            XmlNodeList projectNodes = configDoc.GetElementsByTagName("LayoutDocument");
            for (int i = projectNodes.Count - 1; i > -1; i--)