private void CreateOrUnhideDockableContent(ContentTypes contentType, string title, string viewPropertyName, object parent) { if (!this.dockableContents.Keys.Contains(contentType)) { DockableContent dockableContent = new DockableContent(); ContentControl contentControl = new ContentControl(); dockableContent.IsCloseable = true; dockableContent.HideOnClose = false; dockableContent.Title = title; dockableContent.Content = contentControl; if (parent is ResizingPanel) { DockablePane dockablePane = new DockablePane(); dockablePane.Items.Add(dockableContent); ResizingPanel resizingPanel = parent as ResizingPanel; switch (contentType) { case ContentTypes.PropertyInspector: resizingPanel.Children.Add(dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(300)); break; case ContentTypes.Outline: resizingPanel.Children.Insert(1, dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250)); break; case ContentTypes.Toolbox: resizingPanel.Children.Insert(0, dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250)); break; } } else if (parent is DockablePane) { DockablePane dockablePane = parent as DockablePane; dockablePane.Items.Add(dockableContent); if (dockablePane.Parent == null) { this.verticalResizingPanel.Children.Add(dockablePane); } } Binding dataContextBinding = new Binding(viewPropertyName); dockableContent.SetBinding(DockableContent.DataContextProperty, dataContextBinding); Binding contentBinding = new Binding("."); contentControl.SetBinding(ContentControl.ContentProperty, contentBinding); this.dockableContents[contentType] = dockableContent; dockableContent.Closed += delegate(object sender, EventArgs args) { contentControl.Content = null; this.dockableContents[contentType].DataContext = null; this.dockableContents.Remove(contentType); }; } else { if (this.dockableContents[contentType].State == DockableContentState.Hidden) { this.dockableContents[contentType].Show(); } } }