/// <summary>Called to update the current selection when items change.</summary> /// <param name="e">The event data for the <see cref="E:System.Windows.Controls.ItemContainerGenerator.ItemsChanged" /> event.</param> // Token: 0x060056C3 RID: 22211 RVA: 0x0017FF2C File Offset: 0x0017E12C protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) { base.OnItemsChanged(e); if (e.Action == NotifyCollectionChangedAction.Remove && base.SelectedIndex == -1) { int num = e.OldStartingIndex + 1; if (num > base.Items.Count) { num = 0; } TabItem tabItem = this.FindNextTabItem(num, -1); if (tabItem != null) { tabItem.SetCurrentValueInternal(TabItem.IsSelectedProperty, BooleanBoxes.TrueBox); } } }
/// <summary> /// Updates the current selection when Items has changed /// </summary> /// <param name="e">Information about what has changed</param> protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) { base.OnItemsChanged(e); if (e.Action == NotifyCollectionChangedAction.Remove && SelectedIndex == -1) { // If we remove the selected item we should select the previous item int startIndex = e.OldStartingIndex + 1; if (startIndex > Items.Count) { startIndex = 0; } TabItem nextTabItem = FindNextTabItem(startIndex, -1); if (nextTabItem != null) { nextTabItem.SetCurrentValueInternal(TabItem.IsSelectedProperty, MS.Internal.KnownBoxes.BooleanBoxes.TrueBox); } } }