// Token: 0x060056D1 RID: 22225 RVA: 0x00180420 File Offset: 0x0017E620 private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TabItem tabItem = d as TabItem; bool flag = (bool)e.NewValue; TabControl tabControlParent = tabItem.TabControlParent; if (tabControlParent != null) { tabControlParent.RaiseIsSelectedChangedAutomationEvent(tabItem, flag); } if (flag) { tabItem.OnSelected(new RoutedEventArgs(Selector.SelectedEvent, tabItem)); } else { tabItem.OnUnselected(new RoutedEventArgs(Selector.UnselectedEvent, tabItem)); } if (flag) { Binding binding = new Binding("Margin"); binding.Source = tabItem; BindingOperations.SetBinding(tabItem, KeyboardNavigation.DirectionalNavigationMarginProperty, binding); } else { BindingOperations.ClearBinding(tabItem, KeyboardNavigation.DirectionalNavigationMarginProperty); } tabItem.UpdateVisualState(); }
private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TabItem tabItem = d as TabItem; bool isSelected = (bool)e.NewValue; TabControl parentTabControl = tabItem.TabControlParent; if (parentTabControl != null) { parentTabControl.RaiseIsSelectedChangedAutomationEvent(tabItem, isSelected); } if (isSelected) { tabItem.OnSelected(new RoutedEventArgs(Selector.SelectedEvent, tabItem)); } else { tabItem.OnUnselected(new RoutedEventArgs(Selector.UnselectedEvent, tabItem)); } // KeyboardNavigation use bounding box reduced with DirectionalNavigationMargin when calculating the next element in directional navigation // Because TabItem use negative margins some TabItems overlap which would changes the directional navigation if we don't reduce the bounding box if (isSelected) { Binding binding = new Binding("Margin"); binding.Source = tabItem; BindingOperations.SetBinding(tabItem, KeyboardNavigation.DirectionalNavigationMarginProperty, binding); } else { BindingOperations.ClearBinding(tabItem, KeyboardNavigation.DirectionalNavigationMarginProperty); } tabItem.UpdateVisualState(); }