void BuildDockingLayout() { dockManager.Content = null; //TreeView dockable content var trv = new TreeView(); trv.Items.Add(new TreeViewItem() { Header = "Item1" }); trv.Items.Add(new TreeViewItem() { Header = "Item2" }); trv.Items.Add(new TreeViewItem() { Header = "Item3" }); trv.Items.Add(new TreeViewItem() { Header = "Item4" }); ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = "SubItem1" }); ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = "SubItem2" }); ((TreeViewItem)trv.Items[1]).Items.Add(new TreeViewItem() { Header = "SubItem3" }); ((TreeViewItem)trv.Items[2]).Items.Add(new TreeViewItem() { Header = "SubItem4" }); var treeviewContent = new DockableContent() { Title = "Explorer", Content = trv }; treeviewContent.Show(dockManager, AnchorStyle.Bottom); //TextBox invo dockable content var treeviewInfoContent = new DockableContent() { Title = "Explorer Info", Content = new TextBox() { Text = "Explorer Info Text", IsReadOnly = true } }; treeviewContent.ContainerPane.Items.Add(treeviewInfoContent); //ListView dockable content var gridView = new GridView(); gridView.Columns.Add(new GridViewColumn() { Header = "Date" }); gridView.Columns.Add(new GridViewColumn() { Header = "Day Of Weeek", DisplayMemberBinding = new Binding("DayOfWeek") }); gridView.Columns.Add(new GridViewColumn() { Header = "Year", DisplayMemberBinding = new Binding("Year") }); gridView.Columns.Add(new GridViewColumn() { Header = "Month", DisplayMemberBinding = new Binding("Month") }); gridView.Columns.Add(new GridViewColumn() { Header = "Second", DisplayMemberBinding = new Binding("Second") }); var listView = new ListView() { View = gridView }; listView.Items.Add(DateTime.Now); listView.Items.Add(DateTime.Now.AddYears(-1)); listView.Items.Add(DateTime.Now.AddMonths(15)); listView.Items.Add(DateTime.Now.AddHours(354)); var listViewContent = new DockableContent() { Title = "Date & Times", Content = listView }; listViewContent.ShowAsFloatingWindow(dockManager, true); //TextBox dockable content var textboxSampleContent = new DockableContent() { Title = "Date & Times Info", Content = new TextBox() { Text = "Date & Times Info Text", IsReadOnly = true } }; listViewContent.ContainerPane.Items.Add(textboxSampleContent); //DataGrid document //var dataGrid = new DataGrid(); //var rnd = new Random(); //var data = new List<Tuple<double, double, double, double>>(); //for (int i = 0; i < 100; i++) //{ // data.Add(Tuple.Create(rnd.NextDouble(), rnd.NextDouble() * 10.0, rnd.NextDouble() * 100.0, rnd.NextDouble() * 1000.0)); //} //dataGrid.ItemsSource = data; //var dataGridDocument = new DocumentContent() { Title = "Data", IsLocked = true, Content = dataGrid }; //dataGridDocument.Show(dockManager); ////DataGrid Info Text sample //var dataGridInfoContent = new DockableContent() { Title = "Data Info", Content = new TextBox() { Text = "Data Info Text" } }; //dataGridInfoContent.ShowAsDocument(dockManager); }
public FlyoutDockablePane(DockableContent content) { _referencedPane = content.ContainerPane as DockablePane; _manager = _referencedPane.GetManager(); //save current content position in container pane _arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content); Anchor = _referencedPane.Anchor; SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Width)); SetValue(ResizingPanel.ResizeHeightProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Height)); //if (double.IsInfinity(ResizingPanel.GetResizeWidth(this))) // ResizingPanel.SetResizeWidth(this, 200); //if (double.IsInfinity(ResizingPanel.GetResizeHeight(this))) // ResizingPanel.SetResizeHeight(this, 200); this.Style = _referencedPane.Style; //remove content from container pane //and add content to my temporary pane _referencedPane.Items.RemoveAt(_arrayIndexPreviousPane); this.Items.Add(content); //select the single content in this pane SelectedItem = this.Items[0]; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 2: this.SideBarExplorer = ((AvalonDock.DockablePane)(target)); return; case 3: this.MainComponentContainer = ((AvalonDock.DocumentPane)(target)); return; case 4: this.errorsContent = ((AvalonDock.DockableContent)(target)); return; case 5: this.output = ((AvalonDock.DockableContent)(target)); return; } this._contentLoaded = true; }
public void RemovePane(DockableContent content) { if (this.DockableContents.Contains(content)) this.DockableContents.Remove(content); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.mnuFlipContent = ((System.Windows.Controls.MenuItem)(target)); #line 12 "..\..\Window5.xaml" this.mnuFlipContent.Click += new System.Windows.RoutedEventHandler(this.ShowDockingManager_Click); #line default #line hidden return; case 2: this.TestContainer = ((System.Windows.Controls.ContentControl)(target)); return; case 3: this._dockingManager = ((AvalonDock.DockingManager)(target)); #line 16 "..\..\Window5.xaml" this._dockingManager.Loaded += new System.Windows.RoutedEventHandler(this._dockingManager_Loaded); #line default #line hidden return; case 4: this.content1 = ((AvalonDock.DockableContent)(target)); return; case 5: this.content2 = ((AvalonDock.DockableContent)(target)); return; case 6: this.content3 = ((AvalonDock.DockableContent)(target)); return; case 7: this.bottomPanel = ((AvalonDock.ResizingPanel)(target)); return; case 8: this.ShowMeFirst = ((AvalonDock.DockableContent)(target)); return; case 9: this.ShowMeSecond = ((AvalonDock.DockableContent)(target)); return; case 10: this.AlsoShowMeSecond = ((AvalonDock.DockableContent)(target)); return; } this._contentLoaded = true; }
private void doTest(object sender, RoutedEventArgs e) { DocumentPane pane = (Application.Current as IAppTemplate).RequestDockingPoint<DocumentPane>(this) as DocumentPane; DockableContent dc = new DockableContent(); dc.Title = "Corp Wallet"; ReportsPage page = new ReportsPage(); dc.Content = page; pane.Items.Add(dc); dc.Focus(); }
void _pluginManager_RequestShowContent(IBioLinkPlugin plugin, string name) { String contentName = plugin.Name + "_" + name; AvalonDock.DockableContent content = dockManager.DockableContents.FirstOrDefault((candidate) => { return(candidate.Name.Equals(contentName)); }); if (content != null) { content.Show(); } }
private void doTest(object sender, RoutedEventArgs e) { DocumentPane pane = (Application.Current as IAppTemplate).RequestDockingPoint<DocumentPane>(this) as DocumentPane; DockableContent dc = new DockableContent(); dc.Title = "API View"; APITestDialog dlg = new APITestDialog(); dc.Content = dlg; pane.Items.Add(dc); dc.Focus(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 2: this.SideBarExplorer = ((AvalonDock.DockablePane)(target)); #line 7 "..\..\Panels.xaml" this.SideBarExplorer.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.SideBarExplorerSelectionChanged); #line default #line hidden return; case 3: this.MainComponentContainer = ((AvalonDock.DocumentPane)(target)); #line 8 "..\..\Panels.xaml" this.MainComponentContainer.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.MainComponentContainerSelectionChanged); #line default #line hidden return; case 4: this.BottomBar = ((AvalonDock.DockablePane)(target)); return; case 5: this.errorPane = ((AvalonDock.DockableContent)(target)); return; case 6: this.outputPane = ((AvalonDock.DockableContent)(target)); return; case 7: this.listView1 = ((System.Windows.Controls.ListView)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this._dockManager = ((AvalonDock.DockingManager)(target)); return; case 2: this.UpperContent = ((AvalonDock.DockableContent)(target)); return; case 3: this.LowerContent = ((AvalonDock.DockableContent)(target)); return; } this._contentLoaded = true; }
void BuildDockingLayout() { dockManager.Content = null; trv = new System.Windows.Controls.TreeView(); TreeViewItem tvitem = GetTreeView("recorded_vid", "Recorded Video", @"C:\Users\UA\Documents\Project\Displayer\P001DS004Tvs2012\Icon\Video Call-50.png"); trv.Items.Add(tvitem); foreach(var video in dbController.list_video()){ ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = video }); } trv.MouseDoubleClick += trv_NodeMouseDoubleClick; var treeviewContent_right = new DockableContent() { Title = "Video Lists", Content = trv }; treeviewContent_right.Show(dockManager, AnchorStyle.Right); var treeviewContent_left = new DockableContent() { Title = "Device Lists", Content = new System.Windows.Controls.TextBox() { Text = "Device Lists", IsReadOnly = true } }; treeviewContent_left.Show(dockManager, AnchorStyle.Left); treeviewContent_left.ToggleAutoHide(); videoPanel.ShowAsDocument(dockManager); }
public DockableFloatingWindow(DockingManager manager, DockableContent content) : this(manager) { //create a new temporary pane FloatingDockablePane pane = new FloatingDockablePane(this); //setup window size //Width = content.ContainerPane.ActualWidth; //Height = content.ContainerPane.ActualHeight; if (content.FloatingWindowSize.IsEmpty) content.FloatingWindowSize = new Size(content.ContainerPane.ActualWidth, content.ContainerPane.ActualHeight); Width = content.FloatingWindowSize.Width; Height = content.FloatingWindowSize.Height; //save current content position in container pane _previousPane = content.ContainerPane; _arrayIndexPreviousPane = _previousPane.Items.IndexOf(content); pane.Style = content.ContainerPane.Style; //remove content from container pane content.ContainerPane.RemoveContent(_arrayIndexPreviousPane); //add content to my temporary pane pane.Items.Add(content); //let templates access this pane HostedPane = pane; //Change state on contents IsDockableWindow = true; DocumentPane originalDocumentPane = _previousPane as DocumentPane; if (originalDocumentPane != null) originalDocumentPane.CheckContentsEmpty(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 12 "..\..\..\Window1.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click); #line default #line hidden return; case 2: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 3: this.resizeScenarioPanel = ((AvalonDock.ResizingPanel)(target)); return; case 4: this.scenarioDocumentPane = ((AvalonDock.DocumentPane)(target)); return; case 5: this.messagesDockPane = ((AvalonDock.DockablePane)(target)); return; case 6: this.messagesPane = ((AvalonDock.DockableContent)(target)); return; case 7: this.txtMessages = ((System.Windows.Controls.TextBox)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Hide a dockable content removing it from its container <see cref="Pane"/> /// </summary> /// <param name="content">Content to hide</param> /// <remarks>Note that if you simply remove a content from its container without calling this method, the /// layout serializer component can't managed correctly the removed content.</remarks> internal void Hide(DockableContent content) { if (content.State == DockableContentState.Hidden) { DockableContents.Add(content); return; } if (!content.IsCloseable) return; if (content.State != DockableContentState.FloatingWindow && content.State != DockableContentState.DockableWindow) { //save position only if hiding from a docked or autohidden pane content.SaveCurrentStateAndPosition(); } if (content.State == DockableContentState.AutoHide) { HideFlyoutWindow(); RemoveContentFromTabGroup(content); } if (content.State == DockableContentState.FloatingWindow || content.State == DockableContentState.DockableWindow) { DockableFloatingWindow floatingWindow = Window.GetWindow(content) as DockableFloatingWindow; if (floatingWindow != null && (floatingWindow.Content as Pane).HasSingleItem && !floatingWindow.IsClosing) { floatingWindow.Close(); } } if (content.State != DockableContentState.Hidden) { DockableContents.Add(content); content.SetStateToHidden(); content.DetachFromContainerPane(); } if (ActiveDocument == content) ActiveDocument = null; if (ActiveContent == content) ActiveContent = null; }
/// <summary> /// Show a dockable content in its container <see cref="Pane"/> /// </summary> /// <param name="content">Content to show</param> internal void Show(DockableContent content) { //if desideredState is not defined, use the saved state if exists if (content.SavedStateAndPosition != null) Show(content, content.SavedStateAndPosition.State); else Show(content, DockableContentState.Docked); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 6 "..\..\..\MainWindow.xaml" ((CAGA.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden #line 6 "..\..\..\MainWindow.xaml" ((CAGA.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.RibbonWindow_Closing); #line default #line hidden return; case 2: this.mainGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.ribbon = ((Microsoft.Windows.Controls.Ribbon.Ribbon)(target)); return; case 4: this.RibbonMapGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 5: this.OpenMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 24 "..\..\..\MainWindow.xaml" this.OpenMapBtn.Click += new System.Windows.RoutedEventHandler(this.OpenMapBtn_Click); #line default #line hidden return; case 6: this.SaveMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 25 "..\..\..\MainWindow.xaml" this.SaveMapBtn.Click += new System.Windows.RoutedEventHandler(this.SaveMapBtn_Click); #line default #line hidden return; case 7: this.RibbonLayersGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 8: this.AddLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 29 "..\..\..\MainWindow.xaml" this.AddLayerBtn.Click += new System.Windows.RoutedEventHandler(this.AddLayerBtn_Click); #line default #line hidden return; case 9: this.RemoveLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 30 "..\..\..\MainWindow.xaml" this.RemoveLayerBtn.Click += new System.Windows.RoutedEventHandler(this.RemoveLayerBtn_Click); #line default #line hidden return; case 10: this.RibbonNavGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 11: this.PanMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 33 "..\..\..\MainWindow.xaml" this.PanMapBtn.Checked += new System.Windows.RoutedEventHandler(this.PanMapBtn_Checked); #line default #line hidden #line 33 "..\..\..\MainWindow.xaml" this.PanMapBtn.Unchecked += new System.Windows.RoutedEventHandler(this.PanMapBtn_Unchecked); #line default #line hidden return; case 12: this.ZoomInBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 34 "..\..\..\MainWindow.xaml" this.ZoomInBtn.Checked += new System.Windows.RoutedEventHandler(this.ZoomInBtn_Checked); #line default #line hidden #line 34 "..\..\..\MainWindow.xaml" this.ZoomInBtn.Unchecked += new System.Windows.RoutedEventHandler(this.ZoomInBtn_Unchecked); #line default #line hidden return; case 13: this.ZoomOutBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 35 "..\..\..\MainWindow.xaml" this.ZoomOutBtn.Checked += new System.Windows.RoutedEventHandler(this.ZoomOutBtn_Checked); #line default #line hidden #line 35 "..\..\..\MainWindow.xaml" this.ZoomOutBtn.Unchecked += new System.Windows.RoutedEventHandler(this.ZoomOutBtn_Unchecked); #line default #line hidden return; case 14: this.ZoomToExtentBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 36 "..\..\..\MainWindow.xaml" this.ZoomToExtentBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToExtentBtn_Click); #line default #line hidden return; case 15: this.ZoomToPrevBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 37 "..\..\..\MainWindow.xaml" this.ZoomToPrevBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToPrevBtn_Click); #line default #line hidden return; case 16: this.ZoomToNextBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 38 "..\..\..\MainWindow.xaml" this.ZoomToNextBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToNextBtn_Click); #line default #line hidden return; case 17: this.ZoomToLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 39 "..\..\..\MainWindow.xaml" this.ZoomToLayerBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToLayerBtn_Click); #line default #line hidden return; case 18: this.RibbonSelectionGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 19: this.SelectFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonSplitButton)(target)); #line 42 "..\..\..\MainWindow.xaml" this.SelectFeatureBtn.Click += new System.Windows.RoutedEventHandler(this.SelectFeatureBtn_Click); #line default #line hidden return; case 20: this.SelectFeatureGallery = ((Microsoft.Windows.Controls.Ribbon.RibbonGallery)(target)); return; case 21: this.SelByRectItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 45 "..\..\..\MainWindow.xaml" this.SelByRectItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 22: this.SelByPolyItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 46 "..\..\..\MainWindow.xaml" this.SelByPolyItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 23: this.SelByCircleItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 47 "..\..\..\MainWindow.xaml" this.SelByCircleItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 24: this.SelByLineItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 48 "..\..\..\MainWindow.xaml" this.SelByLineItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 25: this.SelectByGraphicsBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 52 "..\..\..\MainWindow.xaml" this.SelectByGraphicsBtn.Click += new System.Windows.RoutedEventHandler(this.SelectByGraphicsBtn_Click); #line default #line hidden return; case 26: this.UnselectFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 53 "..\..\..\MainWindow.xaml" this.UnselectFeatureBtn.Click += new System.Windows.RoutedEventHandler(this.UnselectFeatureBtn_Click); #line default #line hidden return; case 27: this.RibbonToolsGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 28: this.IdentifyFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 56 "..\..\..\MainWindow.xaml" this.IdentifyFeatureBtn.Checked += new System.Windows.RoutedEventHandler(this.IdentifyFeatureBtn_Checked); #line default #line hidden #line 56 "..\..\..\MainWindow.xaml" this.IdentifyFeatureBtn.Unchecked += new System.Windows.RoutedEventHandler(this.IdentifyFeatureBtn_Unchecked); #line default #line hidden return; case 29: this.AttrTableBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 57 "..\..\..\MainWindow.xaml" this.AttrTableBtn.Click += new System.Windows.RoutedEventHandler(this.AttrTableBtn_Click); #line default #line hidden return; case 30: this.RibbonDrawingGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 31: this.DrawPolygonBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 60 "..\..\..\MainWindow.xaml" this.DrawPolygonBtn.Checked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Checked); #line default #line hidden #line 60 "..\..\..\MainWindow.xaml" this.DrawPolygonBtn.Unchecked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Unchecked); #line default #line hidden return; case 32: this.RibbonDlgMgrGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 33: this.ToggleDlgBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 66 "..\..\..\MainWindow.xaml" this.ToggleDlgBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleDlgBtn_Click); #line default #line hidden return; case 34: this.RibbonSpeechRecGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 35: this.ToggleSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 69 "..\..\..\MainWindow.xaml" this.ToggleSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleSpeechBtn_Click); #line default #line hidden return; case 36: this.SimSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 70 "..\..\..\MainWindow.xaml" this.SimSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.SimSpeechBtn_Click); #line default #line hidden return; case 37: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 38: this.LayersPanel = ((AvalonDock.DockableContent)(target)); return; case 39: this.tocGrid = ((System.Windows.Controls.Grid)(target)); return; case 40: #line 84 "..\..\..\MainWindow.xaml" ((AvalonDock.DocumentPane)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.DocumentPane_SelectionChanged); #line default #line hidden return; case 41: this.MapPanel = ((AvalonDock.DocumentContent)(target)); return; case 42: this.mapGrid = ((System.Windows.Controls.Grid)(target)); return; case 43: this.LayoutPanel = ((AvalonDock.DocumentContent)(target)); return; case 44: this.layoutGrid = ((System.Windows.Controls.Grid)(target)); return; case 45: this.KinectCtrlPanel = ((AvalonDock.DockablePane)(target)); return; case 46: this.ColorDisplayPanel = ((AvalonDock.DockableContent)(target)); return; case 47: this.colorDisplay = ((System.Windows.Controls.Image)(target)); return; case 48: this.skeletonCanvas = ((System.Windows.Controls.Canvas)(target)); return; case 49: this.DepthDisplayPanel = ((AvalonDock.DockableContent)(target)); return; case 50: this.depthDisplay = ((System.Windows.Controls.Image)(target)); return; case 51: this.DevCtrlPanel = ((AvalonDock.DockablePane)(target)); return; case 52: this.statusTB = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
internal void Drag(DockableContent dockableContent, Point point, Point offset) { if (CaptureMouse()) { var floatingWindow = new DockableFloatingWindow(this); floatingWindow.Content = dockableContent; floatingWindow.Owner = Window.GetWindow(this); Drag(floatingWindow, point, offset); } }
bool RemoveContentFromTabGroup(DockableContent contentToRemove) { foreach (Panel anchorTabPanel in _anchorTabPanels) { foreach (DockablePaneAnchorTabGroup group in anchorTabPanel.Children) { foreach (DockablePaneAnchorTab tab in group.Children) { if (tab.ReferencedContent == contentToRemove) { group.Children.Remove(tab); if (group.Children.Count == 0) anchorTabPanel.Children.Remove(group); return true; } } } } return false; }
/// <summary> /// Closes or hides provided content depending on HideOnClose property /// </summary> internal virtual void CloseOrHide(DockableContent cntToCloseOrHide, bool force) { Debug.Assert(cntToCloseOrHide != null); if (!force && !cntToCloseOrHide.IsCloseable) return; DockingManager manager = GetManager(); if (cntToCloseOrHide.HideOnClose && manager != null) manager.Hide(cntToCloseOrHide); else RemoveContent(Items.IndexOf(cntToCloseOrHide)); }
///// <summary> ///// Restore from xml a document pane ///// </summary> ///// <param name="childElement"></param> ///// <param name="mainExistingDocumentPane"></param> ///// <param name="existingDocumentPanel"></param> ///// <param name="dockableContents"></param> //void RestoreDocumentPaneLayout(XmlElement childElement, out DocumentPane mainExistingDocumentPane, out DocumentPaneResizingPanel existingDocumentPanel, DockableContent[] dockableContents) //{ // mainExistingDocumentPane = (Content is DocumentPane) ? Content as DocumentPane : GetMainDocumentPane(Content as ResizingPanel); // if (mainExistingDocumentPane != null) // { // existingDocumentPanel = mainExistingDocumentPane.GetParentDocumentPaneResizingPanel(); // } // else // { // existingDocumentPanel = null; // } // if (existingDocumentPanel != null) // { // if (existingDocumentPanel.Parent is ResizingPanel) // { // ((ResizingPanel)existingDocumentPanel.Parent).RemoveChild(existingDocumentPanel); // } // else if (existingDocumentPanel.Parent is DockingManager) // { // ((DockingManager)existingDocumentPanel.Parent).Content = null; // } // } // else if (mainExistingDocumentPane != null) // { // if (mainExistingDocumentPane.Parent is ResizingPanel) // { // ((ResizingPanel)mainExistingDocumentPane.Parent).RemoveChild(mainExistingDocumentPane); // } // else if (mainExistingDocumentPane.Parent is DockingManager) // { // ((DockingManager)mainExistingDocumentPane.Parent).Content = null; // } // } // foreach (XmlElement contentElement in childElement.ChildNodes) // { // if (contentElement.HasAttribute("Name")) // { // DockableContent foundContent = null; // string contentName = contentElement.GetAttribute("Name"); // foreach (DockableContent content in dockableContents) // { // if (content.Name == contentName) // { // foundContent = content; // break; // } // } // if (foundContent == null && // DeserializationCallback != null) // { // DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName); // DeserializationCallback(this, e); // foundContent = e.Content as DockableContent; // } // if (foundContent != null) // { // DetachContentFromDockingManager(foundContent); // mainExistingDocumentPane.Items.Add(foundContent); // foundContent.SetStateToDocument(); // //call custom layout persistence method // foundContent.RestoreLayout(contentElement); // } // } // } //} DocumentPane RestoreDocumentPaneLayout(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments) { var documentPane = new DocumentPane(); if (mainElement.HasAttribute("ResizeWidth")) ResizingPanel.SetResizeWidth(documentPane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeWidth"))); if (mainElement.HasAttribute("ResizeHeight")) ResizingPanel.SetResizeHeight(documentPane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeHeight"))); if (mainElement.HasAttribute("EffectiveSize")) ResizingPanel.SetEffectiveSize(documentPane, (Size)(new SizeConverter()).ConvertFromInvariantString(mainElement.GetAttribute("EffectiveSize"))); foreach (XmlElement contentElement in mainElement.ChildNodes) { if (contentElement.Name == "DockableContent" && contentElement.HasAttribute("Name")) { DockableContent foundContent = null; string contentName = contentElement.GetAttribute("Name"); foundContent = actualContents.FirstOrDefault(c => c.Name == contentName); if (foundContent == null && DeserializationCallback != null) { DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName); DeserializationCallback(this, e); foundContent = e.Content as DockableContent; } if (foundContent != null) { DetachContentFromDockingManager(foundContent); documentPane.Items.Add(foundContent); foundContent.SetStateToDocument(); //call custom layout persistence method foundContent.RestoreLayout(contentElement); } } else if (contentElement.Name == "DocumentContent" && contentElement.HasAttribute("Name")) { DocumentContent foundDocument = null; string contentName = contentElement.GetAttribute("Name"); foundDocument = actualDocuments.FirstOrDefault(c => c.Name == contentName); if (foundDocument == null && DeserializationCallback != null) { DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName); DeserializationCallback(this, e); foundDocument = e.Content as DocumentContent; } if (foundDocument != null) { foundDocument.DetachFromContainerPane(); documentPane.Items.Add(foundDocument); } } } if (mainElement.HasAttribute("SelectedIndex")) documentPane.SelectedIndex = XmlConvert.ToInt32(mainElement.GetAttribute("SelectedIndex")); return documentPane; }
/// <summary> /// Shows a flyout window for a content /// </summary> /// <param name="content">Content to show</param> internal void ShowFlyoutWindow(DockableContent content, DockablePaneAnchorTab tabActivating) { //check if parent window is Active Window parentWindow = Window.GetWindow(this); if (parentWindow == null || !parentWindow.IsVisible) return; if (!parentWindow.IsActive && (_flyoutWindow == null || !_flyoutWindow.IsActive)) return; //check if content is already visible in a flyout window if (_flyoutWindow != null && _flyoutWindow.ReferencedPane.Items.Contains(content)) { //continue to show the winow //_flyoutWindow.KeepWindowOpen(); return; } //hide previous window HideFlyoutWindow(); //select this content in the referenced pane content.ContainerPane.SelectedItem = content; if (_wndInteropWrapper == null) { _wndInteropWrapper = new WindowInteropWrapper(parentWindow); _wndInteropWrapper.WindowPosChanging += (s, e) => { //update the flyout window UpdateFlyoutWindowPosition(); }; } //create e new window _flyoutWindow = new FlyoutPaneWindow(this, content); _flyoutWindow.Owner = parentWindow; _flyoutWindow.FlowDirection = this.FlowDirection; _flyoutWindow.ShowActivated = false; _flyoutWindow.AnchorTabActivating = tabActivating; UpdateFlyoutWindowPosition(true); _flyoutWindow.Closing += new System.ComponentModel.CancelEventHandler(OnFlyoutWindowClosing); _flyoutWindow.Show(); //this.Focus(); }
public void AddPaneForLayoutRestore(DockableContent content) { this.DockableContents.Add(content); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 6 "..\..\Demo.xaml" ((AvalonDockTest.Demo)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden #line 6 "..\..\Demo.xaml" ((AvalonDockTest.Demo)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.ShowDockingManager = ((System.Windows.Controls.MenuItem)(target)); #line 90 "..\..\Demo.xaml" this.ShowDockingManager.Click += new System.Windows.RoutedEventHandler(this.ShowDockingManager_Checked); #line default #line hidden return; case 3: #line 91 "..\..\Demo.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor_Clicked); #line default #line hidden return; case 4: #line 92 "..\..\Demo.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor_Clicked); #line default #line hidden return; case 5: #line 93 "..\..\Demo.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor_Clicked); #line default #line hidden return; case 6: #line 94 "..\..\Demo.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor_Clicked); #line default #line hidden return; case 7: #line 95 "..\..\Demo.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor_Clicked); #line default #line hidden return; case 8: #line 96 "..\..\Demo.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor_Clicked); #line default #line hidden return; case 9: #line 97 "..\..\Demo.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeColor_Clicked); #line default #line hidden return; case 10: #line 99 "..\..\Demo.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ResetColors_Clicked); #line default #line hidden return; case 11: this.TestContainer = ((System.Windows.Controls.ContentControl)(target)); return; case 12: this._dockingManager = ((AvalonDock.DockingManager)(target)); return; case 13: this._propertiesWindow = ((AvalonDock.DockableContent)(target)); return; case 14: this._documentsHost = ((AvalonDock.DocumentPane)(target)); return; case 15: this.docHome = ((AvalonDock.DocumentContent)(target)); #line 124 "..\..\Demo.xaml" this.docHome.Closing += new System.EventHandler <System.ComponentModel.CancelEventArgs>(this.doc_Closing); #line default #line hidden return; case 16: this.NewDocuments = ((System.Windows.Documents.Hyperlink)(target)); #line 194 "..\..\Demo.xaml" this.NewDocuments.Click += new System.Windows.RoutedEventHandler(this.NewDocuments_Click); #line default #line hidden return; case 17: this.ShowProperties = ((System.Windows.Documents.Hyperlink)(target)); #line 196 "..\..\Demo.xaml" this.ShowProperties.Click += new System.Windows.RoutedEventHandler(this.ShowProperties_Click); #line default #line hidden return; case 18: this.ShowProperties_AutoHide = ((System.Windows.Documents.Hyperlink)(target)); #line 197 "..\..\Demo.xaml" this.ShowProperties_AutoHide.Click += new System.Windows.RoutedEventHandler(this.ShowProperties_Click); #line default #line hidden return; case 19: this.ShowProperties_FloatingWindow = ((System.Windows.Documents.Hyperlink)(target)); #line 198 "..\..\Demo.xaml" this.ShowProperties_FloatingWindow.Click += new System.Windows.RoutedEventHandler(this.ShowProperties_Click); #line default #line hidden return; case 20: this.ShowExplorer = ((System.Windows.Documents.Hyperlink)(target)); #line 200 "..\..\Demo.xaml" this.ShowExplorer.Click += new System.Windows.RoutedEventHandler(this.ShowExplorer_Click); #line default #line hidden return; case 21: this.ShowExplorer_AutoHide = ((System.Windows.Documents.Hyperlink)(target)); #line 201 "..\..\Demo.xaml" this.ShowExplorer_AutoHide.Click += new System.Windows.RoutedEventHandler(this.ShowExplorer_Click); #line default #line hidden return; case 22: this.ShowExplorer_FloatingWindow = ((System.Windows.Documents.Hyperlink)(target)); #line 202 "..\..\Demo.xaml" this.ShowExplorer_FloatingWindow.Click += new System.Windows.RoutedEventHandler(this.ShowExplorer_Click); #line default #line hidden return; case 23: this.ShowEventsLog = ((System.Windows.Documents.Hyperlink)(target)); #line 204 "..\..\Demo.xaml" this.ShowEventsLog.Click += new System.Windows.RoutedEventHandler(this.ShowEventsLog_Click); #line default #line hidden return; case 24: this.ShowEventsLog_AutoHide = ((System.Windows.Documents.Hyperlink)(target)); #line 205 "..\..\Demo.xaml" this.ShowEventsLog_AutoHide.Click += new System.Windows.RoutedEventHandler(this.ShowEventsLog_Click); #line default #line hidden return; case 25: this.ShowEventsLog_FloatingWindow = ((System.Windows.Documents.Hyperlink)(target)); #line 206 "..\..\Demo.xaml" this.ShowEventsLog_FloatingWindow.Click += new System.Windows.RoutedEventHandler(this.ShowEventsLog_Click); #line default #line hidden return; case 26: this.ShowEventsLog_DockRight = ((System.Windows.Documents.Hyperlink)(target)); #line 207 "..\..\Demo.xaml" this.ShowEventsLog_DockRight.Click += new System.Windows.RoutedEventHandler(this.ShowEventsLog_Click); #line default #line hidden return; case 27: this.ShowProperty = ((System.Windows.Documents.Hyperlink)(target)); #line 209 "..\..\Demo.xaml" this.ShowProperty.Click += new System.Windows.RoutedEventHandler(this.ShowProperty_Click); #line default #line hidden return; case 28: this.ShowProperty_AutoHide = ((System.Windows.Documents.Hyperlink)(target)); #line 210 "..\..\Demo.xaml" this.ShowProperty_AutoHide.Click += new System.Windows.RoutedEventHandler(this.ShowProperty_Click); #line default #line hidden return; case 29: this.ShowProperty_FloatingWindow = ((System.Windows.Documents.Hyperlink)(target)); #line 211 "..\..\Demo.xaml" this.ShowProperty_FloatingWindow.Click += new System.Windows.RoutedEventHandler(this.ShowProperty_Click); #line default #line hidden return; case 30: this.ShowProperty_DockRight = ((System.Windows.Documents.Hyperlink)(target)); #line 212 "..\..\Demo.xaml" this.ShowProperty_DockRight.Click += new System.Windows.RoutedEventHandler(this.ShowProperty_Click); #line default #line hidden return; case 31: this.SaveLayout = ((System.Windows.Documents.Hyperlink)(target)); #line 214 "..\..\Demo.xaml" this.SaveLayout.Click += new System.Windows.RoutedEventHandler(this.SaveLayout_Click); #line default #line hidden return; case 32: this.RestoreLayout = ((System.Windows.Documents.Hyperlink)(target)); #line 215 "..\..\Demo.xaml" this.RestoreLayout.Click += new System.Windows.RoutedEventHandler(this.RestoreLayout_Click); #line default #line hidden return; case 33: this._objectExplorerHost = ((AvalonDock.DockableContent)(target)); return; case 34: this._errorList = ((AvalonDockTest.ErrorListContent)(target)); return; case 35: this._eventsLogWindow = ((AvalonDock.DockableContent)(target)); return; case 36: this._txtLog = ((System.Windows.Controls.TextBox)(target)); return; case 37: this._explorerWindow = ((AvalonDock.DockableContent)(target)); return; case 38: this.tabControl = ((System.Windows.Controls.TabControl)(target)); return; case 39: this.ButtonDefault = ((System.Windows.Controls.Button)(target)); #line 271 "..\..\Demo.xaml" this.ButtonDefault.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 40: this.ButtonDefault2 = ((System.Windows.Controls.Button)(target)); #line 275 "..\..\Demo.xaml" this.ButtonDefault2.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 41: this.ButtonDefault3 = ((System.Windows.Controls.Button)(target)); #line 276 "..\..\Demo.xaml" this.ButtonDefault3.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; } this._contentLoaded = true; }
void SaveLayout(XmlWriter xmlWriter, DockableContent content) { /* * CHANGE */ if (this.bLayoutUseExcludedContents) if (this.excludedContents != null) if (this.excludedContents.Contains(content)) return; /* * END CHANGE */ Debug.Assert(!string.IsNullOrEmpty(content.Name), "DockableContent must have a Name to save its content.\n" + "Click Ignore to skip this element and continue with save." ); if (!string.IsNullOrEmpty(content.Name)) { xmlWriter.WriteStartElement("DockableContent"); xmlWriter.WriteAttributeString("Name", content.Name); content.SaveLayout(xmlWriter); xmlWriter.WriteEndElement(); } }
internal FloatingDockablePane(DockableFloatingWindow floatingWindow, DockableContent contentToTransfer) { _floatingWindow = floatingWindow; _contentToTransfer = contentToTransfer; }
/// <summary> /// Adds a new side menu window /// </summary> /// <param name="title">The title of the side menu.</param> /// <param name="control">The control that will be inserted into the side menu.</param> public void AddDockablePane(string title, UserControl control) { var dockable = new DockableContent() { Title = title, Content = control, IsCloseable = false, DockableStyle = DockableStyle.AutoHide, }; dockable.Show(this.dockManger); }
/// <summary> /// Show a dockable content in its container with a desidered state /// </summary> /// <param name="content">Content to show</param> /// <param name="desideredState">State desidered</param> internal void Show(DockableContent content, DockableContentState desideredState) { Show(content, desideredState, AnchorStyle.None); }
ResizingPanel RestoreResizingPanel(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments, ref DocumentPane mainDocumentPane) { ResizingPanel panel = null; if (mainElement.Name == "DocumentPaneResizingPanel") panel = new DocumentPaneResizingPanel(); else panel = new ResizingPanel(); if (mainElement.HasAttribute("Orientation")) panel.Orientation = (Orientation)Enum.Parse(typeof(Orientation), mainElement.GetAttribute("Orientation")); if (mainElement.HasAttribute("ResizeWidth")) ResizingPanel.SetResizeWidth(panel, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeWidth"))); if (mainElement.HasAttribute("ResizeHeight")) ResizingPanel.SetResizeHeight(panel, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeHeight"))); if (mainElement.HasAttribute("EffectiveSize")) ResizingPanel.SetEffectiveSize(panel, (Size)(new SizeConverter()).ConvertFromInvariantString(mainElement.GetAttribute("EffectiveSize"))); foreach (XmlElement childElement in mainElement.ChildNodes) { if (childElement.Name == "ResizingPanel" || childElement.Name == "DocumentPaneResizingPanel") { var childPanel = RestoreResizingPanel(childElement, actualContents, actualDocuments, ref mainDocumentPane); if (childPanel.Children.Count > 0) { panel.Children.Add(childPanel); } else { Debug.WriteLine("Found empty ResizingPanel in stored layout, it will be discarded."); } } #region Restore DockablePane else if (childElement.Name == "DockablePane") { var pane = RestoreDockablePaneLayout(childElement, actualContents, actualDocuments); //restore dockable panes even if no contents are inside (an hidden content could refer this pane in SaveStateAndPosition) panel.Children.Add(pane); } #endregion #region Restore Contents inside a DocumentPane else if (childElement.Name == "DocumentPane") { var documentPane = RestoreDocumentPaneLayout(childElement, actualContents, actualDocuments); bool isMainDocumentPane = false; if (childElement.HasAttribute("IsMain")) isMainDocumentPane = XmlConvert.ToBoolean(childElement.GetAttribute("IsMain")); if (documentPane.Items.Count > 0 || isMainDocumentPane) panel.Children.Add(documentPane); if (isMainDocumentPane) { if (mainDocumentPane != null) throw new InvalidOperationException("Main document pane is set more than one time"); mainDocumentPane = documentPane; } } #endregion } return panel; }
/// <summary> /// Show a dockable content in its container with a desidered state /// </summary> /// <param name="content">Content to show</param> /// <param name="desideredState">State desidered</param> /// <param name="desideredAnchor">Border to which anchor the newly created container pane</param> /// <remarks></remarks> internal void Show(DockableContent content, DockableContentState desideredState, AnchorStyle desideredAnchor) { Debug.WriteLine(string.Format("Show Content={0}, desideredState={1}, desideredAnchor={2}", content.Name, desideredState, desideredAnchor)); #region Dockable content if (desideredState == DockableContentState.Hidden)//??!!show hidden? Hide(content); if (content.State == DockableContentState.AutoHide) { //first redock the content (content.ContainerPane as DockablePane).ToggleAutoHide(); //then show it as desidered Show(content, desideredState, desideredAnchor); } else if (content.State == DockableContentState.Docked || content.State == DockableContentState.Document || content.State == DockableContentState.None) { if (content.ContainerPane == null || content.State == DockableContentState.None) { //Problem!? try to rescue if (content.State == DockableContentState.Docked || content.State == DockableContentState.None) { //find the the pane which the desidered anchor style //DockablePane foundPane = this.FindChildDockablePane(desideredAnchor != AnchorStyle.None ? desideredAnchor : AnchorStyle.Right); //first search for a pane with other contents (avoiding empty panes which are containers for hidden contents) ILinqToTree<DependencyObject> itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).IsDocked); if (itemFound == null)//search for all panes (even empty) itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).Items.Count == 0); DockablePane foundPane = itemFound != null ? itemFound.Item as DockablePane : null; if (foundPane != null) { content.SetStateToDock(); foundPane.Items.Add(content); var containerPanel = foundPane.Parent as ResizingPanel; if (containerPanel != null) containerPanel.InvalidateMeasure(); } else { //if no suitable pane was found create e new one on the fly if (content.ContainerPane != null) { content.ContainerPane.RemoveContent(content); } DockablePane pane = new DockablePane(); pane.Items.Add(content); Anchor(pane, desideredAnchor); } } else { //add to main document pane MainDocumentPane.Items.Add(content); } } if (content.ContainerPane.GetManager() == null) { //disconnect the parent pane from previous panel //((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane); if (content.ContainerPane.Parent != null) { ((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane); } Anchor(content.ContainerPane as DockablePane, desideredAnchor); } if (desideredState == DockableContentState.DockableWindow || desideredState == DockableContentState.FloatingWindow) { var floatingWindow = new DockableFloatingWindow(this); floatingWindow.Content = content; var mainWindow = Window.GetWindow(this); if (mainWindow.IsVisible) floatingWindow.Owner = mainWindow; //floatingWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; //if (content.Content != null) //{ // floatingWindow.Width = Math.Min(((FrameworkElement)content.Content).ActualWidth, ResizingPanel.GetResizeWidth(content.ContainerPane)); // floatingWindow.Height = Math.Min(((FrameworkElement)content.Content).ActualHeight, ResizingPanel.GetResizeHeight(content.ContainerPane)); //} //else ////{ // floatingWindow.Width = 400; // floatingWindow.Height = 400; //} floatingWindow.Show(); } else if (desideredState == DockableContentState.AutoHide) { var paneContainer = content.ContainerPane as DockablePane; Debug.Assert(paneContainer != null); if (paneContainer != null) paneContainer.ToggleAutoHide(); content.Activate(); } else if (desideredState == DockableContentState.Document) { DocumentPane docPane = MainDocumentPane; if (docPane != null) { docPane.Items.Add(content.DetachFromContainerPane()); docPane.SelectedItem = content; content.SetStateToDocument(); } } else { content.ContainerPane.SelectedItem = content; content.Activate(); DockablePane dockParent = content.ContainerPane as DockablePane; if (content.ActualWidth == 0.0 && ( dockParent.Anchor == AnchorStyle.Left || dockParent.Anchor == AnchorStyle.Right)) { ResizingPanel.SetResizeWidth(dockParent, new GridLength(200)); ResizingPanel.SetEffectiveSize(dockParent, new Size(200, 0.0)); } else if (content.ActualWidth == 0.0 && ( dockParent.Anchor == AnchorStyle.Top || dockParent.Anchor == AnchorStyle.Bottom)) { ResizingPanel.SetResizeHeight(dockParent, new GridLength(200)); ResizingPanel.SetEffectiveSize(dockParent, new Size(200, 0.0)); } } } else if (content.State == DockableContentState.Document) { if (content.ContainerPane != null) content.ContainerPane.SelectedItem = this; content.Activate(); } else if (content.State == DockableContentState.Hidden || content.State == DockableContentState.DockableWindow || content.State == DockableContentState.FloatingWindow) { if (content.State == DockableContentState.Hidden) { //Debug.Assert(HiddenContents.Contains(content)); //HiddenContents.Remove(content); } else { FloatingWindow floatingWindow = null; floatingWindow = (content.ContainerPane as FloatingDockablePane).FloatingWindow; content.DetachFromContainerPane(); if (floatingWindow.HostedPane.Items.Count == 0) floatingWindow.Close(); } if (desideredState == DockableContentState.Docked || desideredState == DockableContentState.AutoHide) { if (content.SavedStateAndPosition != null && content.SavedStateAndPosition.ContainerPane != null && content.SavedStateAndPosition.ChildIndex >= 0 && content.SavedStateAndPosition.ContainerPane.GetManager() == this && desideredState == DockableContentState.Docked) { //ok previous container pane is here.. Pane prevPane = content.SavedStateAndPosition.ContainerPane; if (content.SavedStateAndPosition.ChildIndex < prevPane.Items.Count) { prevPane.Items.Insert(content.SavedStateAndPosition.ChildIndex, content); } else { prevPane.Items.Add(content); } if (prevPane.Items.Count == 1) { if (!double.IsNaN(content.SavedStateAndPosition.Width) || !double.IsInfinity(content.SavedStateAndPosition.Width)) { ResizingPanel.SetResizeWidth(content, new GridLength(content.SavedStateAndPosition.Width)); } } DockablePane prevDockablePane = prevPane as DockablePane; if (prevDockablePane != null && prevDockablePane.IsAutoHidden) { prevDockablePane.ToggleAutoHide(); } content.SetStateToDock(); content.Activate(); (prevPane.Parent as UIElement).InvalidateMeasure(); } else { if (desideredAnchor == AnchorStyle.None && content.SavedStateAndPosition != null && content.SavedStateAndPosition.Anchor != AnchorStyle.None) desideredAnchor = content.SavedStateAndPosition.Anchor; if (desideredAnchor == AnchorStyle.None) desideredAnchor = AnchorStyle.Right; DockablePane foundPane = null; if (desideredState == DockableContentState.Docked) { //first not empty panes ILinqToTree<DependencyObject> itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).IsDocked); if (itemFound == null)//look for all panes even empty itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).Items.Count == 0); foundPane = itemFound != null ? itemFound.Item as DockablePane : null; } if (foundPane != null) { content.SetStateToDock(); foundPane.Items.Add(content); if ((foundPane.IsAutoHidden && desideredState == DockableContentState.Docked) || (!foundPane.IsAutoHidden && desideredState == DockableContentState.AutoHide)) foundPane.ToggleAutoHide(); } else { DockablePane newHostpane = new DockablePane(); newHostpane.Items.Add(content); if (desideredAnchor == AnchorStyle.Left || desideredAnchor == AnchorStyle.Right) { double w = 200; if (content.SavedStateAndPosition != null && !double.IsInfinity(content.SavedStateAndPosition.Width) && !double.IsNaN(content.SavedStateAndPosition.Width)) w = content.SavedStateAndPosition.Width; ResizingPanel.SetResizeWidth(newHostpane, new GridLength(w)); ResizingPanel.SetEffectiveSize(newHostpane, new Size(w, 0.0)); } else { double h = 200; if (content.SavedStateAndPosition != null && !double.IsInfinity(content.SavedStateAndPosition.Height) && !double.IsNaN(content.SavedStateAndPosition.Height)) h = content.SavedStateAndPosition.Height; ResizingPanel.SetResizeHeight(newHostpane, new GridLength(h)); ResizingPanel.SetEffectiveSize(newHostpane, new Size(0.0, h)); } Anchor(newHostpane, desideredAnchor); if (desideredState == DockableContentState.AutoHide) { ToggleAutoHide(newHostpane); } } } ActiveContent = content; } else if (desideredState == DockableContentState.DockableWindow || desideredState == DockableContentState.FloatingWindow) { DockablePane newHostpane = null; FloatingDockablePane prevHostpane = null; if (content.SavedStateAndPosition != null && content.SavedStateAndPosition.ContainerPane != null && content.SavedStateAndPosition.ContainerPane is FloatingDockablePane) { prevHostpane = content.SavedStateAndPosition.ContainerPane as FloatingDockablePane; if (!prevHostpane.Items.Contains(content)) prevHostpane.Items.Add(content); } else { newHostpane = new DockablePane(); newHostpane.Items.Add(content); } if (desideredState == DockableContentState.DockableWindow) content.SetStateToDockableWindow(); else if (desideredState == DockableContentState.FloatingWindow) content.SetStateToFloatingWindow(); if (prevHostpane != null) { //check to see if floating window that host prevHostPane is already loaded (hosting other contents) var floatingWindow = prevHostpane.Parent as DockableFloatingWindow; if (floatingWindow != null && floatingWindow.IsLoaded) { floatingWindow.Activate(); } else { floatingWindow = new DockableFloatingWindow(this); floatingWindow.Content = content; floatingWindow.WindowStartupLocation = WindowStartupLocation.Manual; floatingWindow.Top = prevHostpane.FloatingWindow.Top; floatingWindow.Left = prevHostpane.FloatingWindow.Left; floatingWindow.Width = prevHostpane.FloatingWindow.Width; floatingWindow.Height = prevHostpane.FloatingWindow.Height; //floatingWindow.Owner = Window.GetWindow(this); var mainWindow = Window.GetWindow(this); if (mainWindow.IsVisible) floatingWindow.Owner = mainWindow; //now I've created a new pane to host the hidden content //if a an hidden content is shown that has prevHostpane as saved pane //I want that it is relocated in this new pane that I've created right now var hiddenContents = DockableContents.Where(c => c.State == DockableContentState.Hidden).ToArray(); foreach (var hiddenContent in hiddenContents) { if (hiddenContent.SavedStateAndPosition.ContainerPane == prevHostpane) { hiddenContent.SavedStateAndPosition = new DockableContentStateAndPosition( (floatingWindow.Content as Pane), hiddenContent.SavedStateAndPosition.ChildIndex, hiddenContent.SavedStateAndPosition.Width, hiddenContent.SavedStateAndPosition.Height, hiddenContent.SavedStateAndPosition.Anchor, hiddenContent.SavedStateAndPosition.State); } } floatingWindow.Show(); } } else if (newHostpane != null) { var floatingWindow = new DockableFloatingWindow(this); floatingWindow.Content = newHostpane; floatingWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; floatingWindow.Width = 200; floatingWindow.Height = 500; //floatingWindow.Owner = Window.GetWindow(this); var mainWindow = Window.GetWindow(this); if (mainWindow.IsVisible) floatingWindow.Owner = mainWindow; floatingWindow.Show(); } } else if (desideredState == DockableContentState.Document) { DocumentPane docPane = MainDocumentPane; if (docPane != null) { docPane.Items.Add(content); docPane.SelectedItem = content; content.SetStateToDocument(); } } } #endregion }
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; }
void DetachContentFromDockingManager(DockableContent content) { if (content.State == DockableContentState.AutoHide) { DockablePane parentContainer = content.Parent as DockablePane; if (parentContainer != null && parentContainer.Items.Count == 1) parentContainer.ToggleAutoHide(); } if (content.State == DockableContentState.DockableWindow || content.State == DockableContentState.FloatingWindow) { DockablePane parentContainer = content.Parent as DockablePane; if (parentContainer != null && parentContainer.Items.Count == 1) { FloatingWindow floatingWindow = Window.GetWindow(content) as FloatingWindow; floatingWindow.Close(true); } } //this content can be hidden also if was contained in closed floating window if (content.State == DockableContentState.Hidden) Show(content, DockableContentState.Docked); content.DetachFromContainerPane(); }
public FlyoutPaneWindow(DockingManager manager, DockableContent content) : this() { //create a new temporary pane _refPane = new FlyoutDockablePane(content); _dockingManager = manager; _winFormsHost = ReferencedPane.GetLogicalChildContained<WindowsFormsHost>(); if (_winFormsHost != null) { AllowsTransparency = false; } this.Loaded += new RoutedEventHandler(FlyoutPaneWindow_Loaded); }
DockablePane RestoreDockablePaneLayout(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments) { DockablePane pane = new DockablePane(); if (mainElement.HasAttribute("Anchor")) pane.Anchor = (AnchorStyle)Enum.Parse(typeof(AnchorStyle), mainElement.GetAttribute("Anchor")); if (mainElement.HasAttribute("ResizeWidth")) ResizingPanel.SetResizeWidth(pane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeWidth"))); if (mainElement.HasAttribute("ResizeHeight")) ResizingPanel.SetResizeHeight(pane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeHeight"))); if (mainElement.HasAttribute("EffectiveSize")) ResizingPanel.SetEffectiveSize(pane, (Size)(new SizeConverter()).ConvertFromInvariantString(mainElement.GetAttribute("EffectiveSize"))); if (mainElement.HasAttribute("ID")) pane.ID = new Guid(mainElement.GetAttribute("ID")); bool toggleAutoHide = false; if (mainElement.HasAttribute("IsAutoHidden")) toggleAutoHide = XmlConvert.ToBoolean(mainElement.GetAttribute("IsAutoHidden")); foreach (XmlElement contentElement in mainElement.ChildNodes) { if (contentElement.HasAttribute("Name")) { DockableContent foundContent = null; string contentName = contentElement.GetAttribute("Name"); foundContent = actualContents.FirstOrDefault(c => c.Name == contentName); if (foundContent == null && DeserializationCallback != null) { DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName); DeserializationCallback(this, e); foundContent = e.Content as DockableContent; } if (foundContent != null) { DetachContentFromDockingManager(foundContent); pane.Items.Add(foundContent); foundContent.SetStateToDock(); //call custom layout persistence method foundContent.RestoreLayout(contentElement); } } } if (toggleAutoHide && pane.Items.Count > 0) ToggleAutoHide(pane); if (mainElement.HasAttribute("SelectedIndex")) pane.SelectedIndex = XmlConvert.ToInt32(mainElement.GetAttribute("SelectedIndex")); return pane; }
/// <summary> /// Closes or hides provided content depending on HideOnClose property /// </summary> internal virtual void CloseOrHide(DockableContent cntToCloseOrHide) { CloseOrHide(cntToCloseOrHide, false); }
/// <summary> /// Restore from xml a resizing panel or a documentpane /// </summary> /// <param name="mainElement"></param> /// <param name="actualContents"></param> /// <returns></returns> object RestoreLayout(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments, ref DocumentPane mainDocumentPane) { if (mainElement == null) throw new ArgumentNullException("mainElement"); if (mainElement.Name == "ResizingPanel" || mainElement.Name == "DocumentPaneResizingPanel") { return RestoreResizingPanel(mainElement, actualContents, actualDocuments, ref mainDocumentPane); } else if (mainElement.Name == "DocumentPane") { mainDocumentPane = RestoreDocumentPaneLayout(mainElement, actualContents, actualDocuments); return mainDocumentPane; } throw new InvalidOperationException(string.Format("Unable to deserialize '{0}' element", mainElement.Name)); }
public static void ShowDockable(DockableContent doc) { doc.Show(DockingManager); doc.Activate(); }
void SaveLayout(XmlWriter xmlWriter, DockableContent content) { Debug.Assert(!string.IsNullOrEmpty(content.Name), "DockableContent must have a Name to save its content.\n" + "Click Ignore to skip this element and continue with save." ); if (!string.IsNullOrEmpty(content.Name)) { xmlWriter.WriteStartElement("DockableContent"); xmlWriter.WriteAttributeString("Name", content.Name); content.SaveLayout(xmlWriter); xmlWriter.WriteEndElement(); } }
public DockableContentStateAndPosition( DockableContent cntToSave) { ContainerPane = cntToSave.ContainerPane; ChildIndex = ContainerPane.Items.IndexOf(cntToSave); Width = Math.Max(ContainerPane.ActualWidth, 100.0); Height = Math.Max(ContainerPane.ActualHeight, 100.0); State = cntToSave.State; DockablePane dockablePane = ContainerPane as DockablePane; if (dockablePane != null) { Anchor = dockablePane.Anchor; } }