private void OnCreateNewDockableContent(object sender, RoutedEventArgs e) { string title = "NewContent"; DockableContent[] cnts = this.DockManager.DockableContents.ToArray(); int i = 1; while (cnts.FirstOrDefault(c => c.Title == title) != null) { title = string.Format("NewContent{0}", i); i++; } var newContent = new SampleDockableContent() { Name = title, Title = title }; if (((MenuItem)sender).Header.ToString() == "Create New Floating") { newContent.ShowAsFloatingWindow(DockManager, true); newContent.Activate(); } else { newContent.Show(DockManager, AnchorStyle.Right); newContent.Activate(); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 12 "..\..\..\MainWindow.xaml" ((AvalonDock.DemoApp.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden #line 12 "..\..\..\MainWindow.xaml" ((AvalonDock.DemoApp.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden return; case 2: #line 24 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.OnShowDockableContent); #line default #line hidden return; case 3: #line 32 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.OnCreateNewDockableContent); #line default #line hidden return; case 4: #line 33 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.OnCreateNewDockableContent); #line default #line hidden return; case 5: #line 38 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.OnShowDocumentContent); #line default #line hidden return; case 6: #line 46 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.OnCreateNewDocumentContent); #line default #line hidden return; case 7: #line 50 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveToLayoutFile); #line default #line hidden return; case 8: #line 51 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveToLayoutFile); #line default #line hidden return; case 9: #line 52 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveToLayoutFile); #line default #line hidden return; case 10: #line 53 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveToLayoutFile); #line default #line hidden return; case 11: #line 56 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.RestoreFromLayoutFile); #line default #line hidden return; case 12: #line 57 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.RestoreFromLayoutFile); #line default #line hidden return; case 13: #line 58 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.RestoreFromLayoutFile); #line default #line hidden return; case 14: #line 59 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.RestoreFromLayoutFile); #line default #line hidden return; case 15: #line 61 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ExportLayoutToDocument); #line default #line hidden return; case 16: #line 62 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ImportLayoutFromDocument); #line default #line hidden return; case 17: #line 63 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ResetContent); #line default #line hidden return; case 18: #line 66 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeStandardTheme); #line default #line hidden return; case 19: #line 67 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeStandardTheme); #line default #line hidden return; case 20: #line 68 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeStandardTheme); #line default #line hidden return; case 21: #line 69 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeStandardTheme); #line default #line hidden return; case 22: #line 71 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeCustomTheme); #line default #line hidden return; case 23: #line 72 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeCustomTheme); #line default #line hidden return; case 24: #line 75 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SetDefaultTheme); #line default #line hidden return; case 25: #line 78 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor); #line default #line hidden return; case 26: #line 79 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor); #line default #line hidden return; case 27: #line 80 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor); #line default #line hidden return; case 28: #line 81 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor); #line default #line hidden return; case 29: this.DockManager = ((AvalonDock.DockingManager)(target)); #line 87 "..\..\..\MainWindow.xaml" this.DockManager.Loaded += new System.Windows.RoutedEventHandler(this.DockManager_Loaded); #line default #line hidden #line 88 "..\..\..\MainWindow.xaml" this.DockManager.DocumentClosing += new System.EventHandler <System.ComponentModel.CancelEventArgs>(this.DockManager_DocumentClosing); #line default #line hidden return; case 30: this.Content1 = ((AvalonDock.DemoApp.SampleDockableContent)(target)); return; case 31: this.Content2 = ((AvalonDock.DemoApp.SampleDockableContent)(target)); return; case 32: this.Content3 = ((AvalonDock.DemoApp.SampleDockableContent)(target)); return; case 33: this.Content4 = ((AvalonDock.DemoApp.SampleDockableContent)(target)); return; case 34: this.DockingManagerPropertiesHost = ((AvalonDock.DockableContent)(target)); return; case 35: this.NestedDockingManager = ((AvalonDock.DockableContent)(target)); return; case 36: this.InnerContent1 = ((AvalonDock.DemoApp.SampleDockableContent)(target)); return; case 37: this.InnerDoc1 = ((AvalonDock.DocumentContent)(target)); return; case 38: this.DocumentHost = ((AvalonDock.DocumentPane)(target)); return; case 39: this.Doc1 = ((AvalonDock.DocumentContent)(target)); return; case 40: this.Doc2 = ((AvalonDock.DocumentContent)(target)); return; case 41: this.Doc3 = ((AvalonDock.DocumentContent)(target)); return; case 42: this.Doc4 = ((AvalonDock.DocumentContent)(target)); return; case 43: this.zoomSlider = ((System.Windows.Controls.Slider)(target)); return; } this._contentLoaded = true; }