private void OnCreateNewDocumentContent(object sender, RoutedEventArgs e) { string title = "MainWindow.xml.cs"; DocumentContent[] cnts = this.DockManager.Documents.ToArray(); int i = 1; while (cnts.FirstOrDefault(c => c.Title == title) != null) { title = string.Format("NewDocument{0}", i); i++; } var newContent = new DocumentContent() { Title = title, Content = new TextBox() }; newContent.Icon = new BitmapImage(new Uri(@"Images\database.png", UriKind.Relative)); newContent.ContentTypeDescription = "Base Description of " + title; newContent.InfoTip = System.IO.Path.GetTempPath(); newContent.FloatingWindowSize = new Size(500.0, 500.0); newContent.Show(DockManager, true); newContent.Activate(); }
/// <summary> /// Adds a UserControl to the main component container /// </summary> /// <param name = "control">UserControl element</param> /// <param name = "controlTabTitle">The title to give the tab element</param> public void AddMainComponent(UserControl control, string controlTabTitle) { try { Framework.EventBus.Publish(new PanelEvent(this)); var alreadyOpen = false; DocumentContent focusThis = null; foreach (DocumentContent cCtrl in this.MainComponentContainer.Items) { if (cCtrl.Tag.ToString().CompareTo(controlTabTitle) == 0) { alreadyOpen = true; focusThis = cCtrl; } } if (alreadyOpen == false) { var title = controlTabTitle; if (controlTabTitle.Contains("\\")) { var parts = controlTabTitle.Split('\\'); title = parts[parts.Length - 1]; } var newContentControl = new ContentControl { Margin = new Thickness(0), Content = control }; var newDocumentContent = new DocumentContent { Title = title, Background = Brushes.White, Content = newContentControl, Icon = Framework.Images.GetImage("CutHS", "VS2010ImageLibrary", 12).Source, Tag = controlTabTitle }; newDocumentContent.Closing += this.NewDocumentContentClosing; this.MainComponentContainer.Items.Add(newDocumentContent); newDocumentContent.Show(this.dockManager); newDocumentContent.Activate(); } else { focusThis.Show(this.dockManager); focusThis.Activate(); var newWindow = ( IUserControl )control; newWindow.Dispose(); } control.Focus(); control.BringIntoView(); } catch (Exception error) { Framework.EventBus.Publish(error); } }
public void configure(DocumentPane item) { var document = new DocumentContent { Title = presenter.Header, Content = view, IsCloseable = false }; item.Items.Add(document); document.Show(((Shell)Application.Current.MainWindow).DockManager); //document.Activate(); }
private void ExportLayoutToDocument(object sender, RoutedEventArgs e) { DocumentContent doc = new DocumentContent() { Title = string.Format("Layout_{0}", DateTime.Now.ToString()), Content = new TextBox() { AcceptsReturn = true, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, HorizontalScrollBarVisibility = ScrollBarVisibility.Auto, Text = DockManager.LayoutToString() } }; doc.Show(DockManager); doc.Activate(); }
private void CreateNewDocument(object sender, RoutedEventArgs e) { string baseDocTitle = "MyDocument"; int i = 1; string title = baseDocTitle + i.ToString(); while (dockManager.Documents.Any(d => d.Title == title)) { i++; title = baseDocTitle + i.ToString(); } DocumentContent doc = new DocumentContent() { Title = title }; doc.Show(dockManager); //MyDocuments.Add(new DocumentContent() { Title = title }); }
public void ShowDockPanel(DocumentContent doc) { doc.Show(DockManager); doc.Activate(); }
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.Left); //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); }