// When the NotifyState property changes, perform the relevant logic on the notification TabControl private static void NotifyStatePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { NotifyState oldState = (NotifyState)e.OldValue; NotifyState state = (NotifyState)e.NewValue; NotificationControl control = sender as NotificationControl; if (control == null) { return; } switch (state) { case NotifyState.Collapsed: control.NotifyCollapse(oldState); break; case NotifyState.Docked: control.NotifyDock(oldState); break; case NotifyState.Visible: control.NotifyVisible(oldState); break; } }
/// <summary> /// Depending on NotifyState, translate the passed height /// </summary> public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values.Length != 2 || !(values[0] is double) || !(values[1] is NotifyState)) { return(0); } double height = (double)values[0]; NotifyState state = (NotifyState)values[1]; return(NotificationControl.GetHeight(height, state)); }