Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
 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");
 }
Exemplo n.º 4
0
 private void MainWindow_Unloaded(object sender, RoutedEventArgs e)
 {
     var serializer = new XmlLayoutSerializer(dockManager);
     serializer.Serialize(@".\AvalonDock.config");
 }
Exemplo n.º 5
0
 private void OnSaveLayout(object parameter)
 {
     var layoutSerializer = new XmlLayoutSerializer(dockManager);
     layoutSerializer.Serialize(@".\AvalonDock.Layout.config");
 }