private static void OnShowTooltipChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (!(d is TextBlock) && !(d is Label))
            {
                throw new InvalidOperationException("The CutTooltipBehavior can be attached to a TextBlock or Label only.");
            }

            var behavior = GetBehavior(d);

            if (behavior == null)
            {
                behavior = new CutTooltipBehavior(d as FrameworkElement);
                SetBehavior(d, behavior);
            }

            behavior.OnShowTooltipChanged((CutTextKind)e.OldValue, (CutTextKind)e.NewValue);
        }
        private static void OnShowTooltipChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (!(d is TextBlock) && !(d is Label))
                throw new InvalidOperationException("The CutTooltipBehavior can be attached to a TextBlock or Label only.");

            var behavior = GetBehavior(d);
            if (behavior == null)
            {
                behavior = new CutTooltipBehavior(d as FrameworkElement);
                SetBehavior(d, behavior);
            }

            behavior.OnShowTooltipChanged((CutTextKind)e.OldValue, (CutTextKind)e.NewValue);
        }
 private static void SetBehavior(DependencyObject obj, CutTooltipBehavior value)
 {
     obj.SetValue(BehaviorProperty, value);
 }
 private static void SetBehavior(DependencyObject obj, CutTooltipBehavior value)
 {
     obj.SetValue(BehaviorProperty, value);
 }