Beispiel #1
0
 private static void HandleIsEnabledChanged(
     DependencyObject source,
     DependencyPropertyChangedEventArgs e)
 {
     if (!(source is TextBlock textBlock))
     {
         return;
     }
     if ((bool)e.OldValue)
     {
         FadeTrimming.Fader fader = FadeTrimming.GetFader((DependencyObject)textBlock);
         if (fader != null)
         {
             fader.Detach();
             FadeTrimming.SetFader((DependencyObject)textBlock, (FadeTrimming.Fader)null);
         }
         textBlock.Loaded   -= new RoutedEventHandler(FadeTrimming.HandleTextBlockLoaded);
         textBlock.Unloaded -= new RoutedEventHandler(FadeTrimming.HandleTextBlockUnloaded);
     }
     if (!(bool)e.NewValue)
     {
         return;
     }
     textBlock.Loaded   += new RoutedEventHandler(FadeTrimming.HandleTextBlockLoaded);
     textBlock.Unloaded += new RoutedEventHandler(FadeTrimming.HandleTextBlockUnloaded);
     FadeTrimming.Fader fader1 = new FadeTrimming.Fader(textBlock);
     FadeTrimming.SetFader((DependencyObject)textBlock, fader1);
     fader1.Attach();
 }
Beispiel #2
0
 private static void SetFader(DependencyObject obj, FadeTrimming.Fader value)
 {
     obj.SetValue(FadeTrimming.FaderProperty, (object)value);
 }