LayoutGroup.ReadXml fails to restore any derivate types that does not come with AvalonDock. This is because the types are hard coded into the ReadXml functions which effectively renders any extensions classes unusable in layout restoration scenarios.
I have implemented a small fix for this using reflection. I'm sure better solutions can be implemented, but this should at least highlight what the problem is. The first snippet should be appended after the last else if clause in LayoutGroup.ReadXml.
```
else
{
Type type = FindType(reader.LocalName);
if (type == null)
throw new ArgumentException("AvalonDock.LayoutGroup doesn't know how to deserialize " + reader.LocalName);
serializer = new XmlSerializer(type);
}
```
And the FindType function
```
private Type FindType(string name)
{
foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
foreach (var t in a.GetTypes())
if (t.Name.Equals(name))
return t;
return null;
}
```
I have implemented a small fix for this using reflection. I'm sure better solutions can be implemented, but this should at least highlight what the problem is. The first snippet should be appended after the last else if clause in LayoutGroup.ReadXml.
```
else
{
Type type = FindType(reader.LocalName);
if (type == null)
throw new ArgumentException("AvalonDock.LayoutGroup doesn't know how to deserialize " + reader.LocalName);
serializer = new XmlSerializer(type);
}
```
And the FindType function
```
private Type FindType(string name)
{
foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
foreach (var t in a.GetTypes())
if (t.Name.Equals(name))
return t;
return null;
}
```