private void cmdInspector_Click(object sender, RoutedEventArgs e) { CloseableTab myTab = new CloseableTab(); int newTab = MasterTabs.Items.Count + 1; myTab.Title = "Tab " + newTab.ToString(); if (newTab % 2 > 0) { myTab.Picture = new BitmapImage(new Uri("pack://application:,,,/WW6-WPF;component/Images/16/emblem-package.png")); } else { } MasterTabs.Items.Add(myTab) ; }
private void InitalizeTab(UIElement content) { CloseableTab myTab = new CloseableTab(); int newTab = MasterTabs.Items.Count + 1; myTab.Title = ((IMainTab)content).TabCaption; myTab.Picture = new BitmapImage(new Uri(((IMainTab)content).TabIcon)); AttachEventHandlersToTab((IMainTab)content); Grid tabGrid = new Grid(); tabGrid.SizeChanged += Grid_SizeChanged; tabGrid.Children.Add(content); //Fade in the Grid Content DoubleAnimation fadeInAnimation = new DoubleAnimation(); fadeInAnimation.To = 1; fadeInAnimation.From = 0; fadeInAnimation.EasingFunction = new CubicEase(); fadeInAnimation.Duration = TimeSpan.FromSeconds(0.5); myTab.Content = tabGrid; MasterTabs.Items.Add(myTab); MasterTabs.SelectedIndex = MasterTabs.Items.Count-1; tabGrid.BeginAnimation(Grid.OpacityProperty, fadeInAnimation); InitializeSidePanels(); //ActionPaneDock.Children.Add(((IMainTab)content).ActionPaneContent); //TreePaneDock.Children.Add(((IMainTab)content).TreePaneContent); }