Esempio n. 1
0
 private static void OnIsVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (Equals(e.NewValue, true) &&
         d is UIElement element &&
         d.GetValue(TemplateProperty) is ControlTemplate template)
     {
         if (d.GetValue(AdornerProperty) is null)
         {
             var adorner = TemplatedAdorner.Create(element, template);
             d.SetCurrentValue(AdornerProperty, adorner);
             AdornerService.Show(adorner);
         }
         else
         {
             Debug.Assert(condition: false, message: $"Element {d} already has an info adorner.");
         }
     }