protected override void OnLoad(EventArgs e) { var serializer = new XmlLayoutSerializer(_dockingManager); serializer.LayoutSerializationCallback += (s, args) => { switch (args.Model.ContentId) { case "toolWindow1": args.Content = new TextBlock {Text = args.Model.ContentId}; break; default: args.Content = new TextBox {Text = args.Model.ContentId}; break; } }; serializer.Deserialize( new StringReader( Settings.Default.DefaultLayout)); //LayoutDocument doc = new LayoutDocument() { Title = "test" }; //dockingManager.Layout.Descendents().OfType<LayoutDocumentPane>().First().Children.Add(doc); dockingManagerHost.Child = _dockingManager; base.OnLoad(e); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { var serializer = new XmlLayoutSerializer(dockManager); serializer.LayoutSerializationCallback += (s, args) => { args.Content = args.Content; }; if (File.Exists(@".\AvalonDock.config")) serializer.Deserialize(@".\AvalonDock.config"); }
private void OnLoadLayout(object parameter) { var layoutSerializer = new XmlLayoutSerializer(dockManager); //Here I've implemented the LayoutSerializationCallback just to show // a way to feed layout desarialization with content loaded at runtime //Actually I could in this case let AvalonDock to attach the contents //from current layout using the content ids //LayoutSerializationCallback should anyway be handled to attach contents //not currently loaded layoutSerializer.LayoutSerializationCallback += (s, e) => { //if (e.Model.ContentId == FileStatsViewModel.ToolContentId) // e.Content = Workspace.This.FileStats; //else if (!string.IsNullOrWhiteSpace(e.Model.ContentId) && // File.Exists(e.Model.ContentId)) // e.Content = Workspace.This.Open(e.Model.ContentId); }; layoutSerializer.Deserialize(@".\AvalonDock.Layout.config"); }
private void MainWindow_Unloaded(object sender, RoutedEventArgs e) { var serializer = new XmlLayoutSerializer(dockManager); serializer.Serialize(@".\AvalonDock.config"); }
private void OnSaveLayout(object parameter) { var layoutSerializer = new XmlLayoutSerializer(dockManager); layoutSerializer.Serialize(@".\AvalonDock.Layout.config"); }