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 }; newContent.StateChanged += (s, args) => { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("HiddenContents")); } var dockContent = s as DockableContent; Log(string.Format("Content {0} changed state to {1}", dockContent.Title, dockContent.State)); }; newContent.Show(DockManager, AnchorStyle.Right); newContent.Activate(); }
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 }; newContent.StateChanged += (s, args) => { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("HiddenContents")); var dockContent = s as DockableContent; Log(string.Format("Content {0} changed state to {1}", dockContent.Title, dockContent.State)); }; newContent.Show(DockManager, AnchorStyle.Right); newContent.Activate(); }