I have simple requirement to save layout to file on Close and load the layout when opened. But I am getting error on LoadLayout: root element is missing.
I tried doing into a simple sample and getting the same issue. I have TilesControl (contains 2 tiles) and 2 button to Save & Load layouts.
MemoryStream m = new MemoryStream(); private void Save_Click(object sender, RoutedEventArgs e) { TilesControl.SaveLayout(m); }
private void Load_Click(object sender, RoutedEventArgs e) { TilesControl.LoadLayout(m); //ERROR: Root element is missing. }
//ERROR: Root element is missing.
Please help on this.
Hi,
I will suggest you to change the position of the MemoryStream object to the begining before you try to load the layout:
m.Position = 0;
TilesControl.LoadLayout(m);
Hope that this will help.