protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) { collectionChanging = true; base.OnItemsChanged(e); collectionChanging = false; if ((e.NewItems != null) && (e.NewItems.Count > 0)) { TabView view = (TabView)e.NewItems[0]; this.SelectedItem = view; if (!view.IsLoaded) { RoutedEventHandler loaded = null; loaded = (sender, ea) => { view.Loaded -= loaded; this.InvalidateMeasure(); }; view.Loaded += loaded; } } this.InvalidateMeasure(); }
private static void IsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TabView owner = (TabView)d; bool value = (bool)e.NewValue; if (value && (owner.ParentWindow != null)) { owner.ParentWindow.SelectedView = owner; } }
private static void IsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TabView owner = (TabView)d; bool value = (bool)e.NewValue; // We only update the parent window too, if we are in tab. if (value && owner.IsRegularTab && (owner.ParentWindow != null)) { owner.ParentWindow.SelectedView = owner; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.popupWindow = ((TabbedWPFSample.PopupWindow)(target)); return; case 2: this.tabView = ((TabbedWPFSample.TabView)(target)); return; } this._contentLoaded = true; }
private void OnCloseTab(object sender, ExecutedRoutedEventArgs e) { if ((e.Parameter != null) && (e.Parameter is TabView)) { if (tabViews.Count == 1) { // This is the last tab we are attempting to close. // Close the window. If this is the last window, the application exits. this.Close(); } else { TabView view = (TabView)e.Parameter; // Remove the tab. tabViews.Remove(view); // Close the view and the WebControl. view.Close(); GC.Collect(); } } }