private static void OnMinimumTabWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChromeTabControl ctc = (ChromeTabControl)d; ctc.CoerceValue(PinnedTabWidthProperty); ctc.CoerceValue(MaximumTabWidthProperty); }
private static void SelectedTabBrushPropertyCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChromeTabControl ctc = (ChromeTabControl)d; if (e.NewValue != null && ctc.SelectedItem != null) { ctc.AsTabItem(ctc.SelectedItem).SelectedTabBrush = (Brush)e.NewValue; } }
private static void OnAddButtonTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChromeTabControl ctc = (ChromeTabControl)d; ChromeTabPanel panel = ctc.ItemsHost as ChromeTabPanel; if (panel != null) { panel.SetAddButtonControlTemplate(e.NewValue as ControlTemplate); } }
private static void IsAddButtonVisiblePropertyCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChromeTabControl ctc = d as ChromeTabControl; ChromeTabPanel panel = (ChromeTabPanel)ctc.ItemsHost; if (panel != null) { panel.InvalidateVisual(); } }
private static void OnTabPersistBehaviorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChromeTabControl ct = (ChromeTabControl)d; if (((TabPersistBehavior)e.NewValue) == TabPersistBehavior.None) { ct.itemsHolder?.Children?.Clear(); } else { ct.SetSelectedContent(false); } }
private static object OnCoercePinnedTabWidth(DependencyObject d, object baseValue) { ChromeTabControl ctc = (ChromeTabControl)d; if (ctc.MinimumTabWidth > (double)baseValue) { return(ctc.MinimumTabWidth); } else { return(baseValue); } }
private static void IsAddButtonVisiblePropertyCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (DesignerProperties.GetIsInDesignMode(d)) { return; } ChromeTabControl ctc = d as ChromeTabControl; ChromeTabPanel panel = (ChromeTabPanel)ctc.ItemsHost; if (panel != null) { panel.InvalidateVisual(); } }
private static void AddTabCommandPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (DesignerProperties.GetIsInDesignMode(d)) { return; } ChromeTabControl ct = (ChromeTabControl)d; if (e.NewValue != null) { ICommand command = (ICommand)e.NewValue; command.CanExecuteChanged += ct.Command_CanExecuteChanged; } if (e.OldValue != null) { ICommand command = (ICommand)e.NewValue; command.CanExecuteChanged -= ct.Command_CanExecuteChanged; } }
protected override void OnVisualParentChanged(DependencyObject oldParent) { base.OnVisualParentChanged(oldParent); this.parent = null; }