Hello,
I'm trying to perform the save/load layout of Raddocking with CatelMVVM but I've some points to spot out.
I've implemented the two commands as found on example
private void OnSaveLayoutCommandCommandExecuted(object parameter)
{
this.dockingLayout = this.SaveLayoutAsString(parameter as RadDocking);
// Replace the path from the Layout.xml with the one from the current OS
File.WriteAllText(@"c:\temp\Layout.xml", this.dockingLayout);
}
private void OnLoadLayoutSourceCommandExecuted(object parameter)
{
// Replace the path from the Layout.xml with the one from the current OS
this.dockingLayout = File.ReadAllText(@"c:\temp\Layout.xml");
if (!string.IsNullOrEmpty(this.dockingLayout))
{
this.LoadLayoutFromString(parameter as RadDocking);
}
}
private string SaveLayoutAsString(RadDocking docking)
{
MemoryStream stream = new MemoryStream();
docking.SaveLayout(stream);
stream.Seek(0, SeekOrigin.Begin);
StreamReader reader = new StreamReader(stream);
return reader.ReadToEnd();
}
private void LoadLayoutFromString(RadDocking docking)
{
using (Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(dockingLayout)))
{
stream.Seek(0, SeekOrigin.Begin);
docking.LoadLayout(stream);
}
}
But when I load the layout I got the Pane position correctly fileld but the content is empty (and I understand this since it doesn't know what it has to store in.
Anyone has faced a similar problem and has found a solution? I tought of adding a tag that identifies the type but what about optional parameters? should I add them as well in the serialization tag?
Thanks