Save RadDocking Layout When the Control is Unloaded
Environment
Product Version | 2022.3 912 |
Product | RadDocking for WPF |
Description
How to save the layout of the RadDocking control when its unloaded.
Solution
-
Add a new event handler for the
Unloaded
event of theRadDocking
using theEventManager.RegisterClassHandler
static method.Add a new event handler for the Unloaded event of RadDocking
EventManager.RegisterClassHandler(typeof(RadDocking), RadDocking. UnloadedEvent, new RoutedEventHandler(OnUnloaded));
EventManager.RegisterClassHandler(GetType(RadDocking), RadDocking. UnloadedEvent, New RoutedEventHandler(OnUnloaded))
-
Implement the save logic in the newly added event handler for the
Unloaded
event.Sample implementation of saving the layout in the newly added handler
private void OnUnloaded(object sender, RoutedEventArgs e) { using (IsolatedStorageFile storage = IsolatedStorageFile. GetUserStoreForAssembly()) { using (var isoStream = storage.OpenFile("RadDocking_Layout.xml", FileMode.Create)) { this.radDocking.SaveLayout(isoStream); } } }
Private Sub OnUnloaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Using storage As IsolatedStorageFile = IsolatedStorageFile. GetUserStoreForAssembly() Using isoStream = storage.OpenFile("RadDocking_Layout.xml", FileMode.Create) Me.radDocking.SaveLayout(isoStream) End Using End Using End Sub