Create() static private method

static private Create ( UIElement element, System.Windows.Controls.ControlTemplate template ) : System.Windows.Documents.Adorner
element UIElement
template System.Windows.Controls.ControlTemplate
return System.Windows.Documents.Adorner
Exemplo n.º 1
0
        private static void OnIsShowingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var element = (UIElement)d;

            if (Equals(e.NewValue, true))
            {
                var adorner = element.GetAdorner();
                if (adorner == null)
                {
                    adorner = TemplatedAdorner.Create(element, (ControlTemplate)element.GetValue(TemplateProperty));
                    element.SetAdorner(adorner);
                }

                AdornerService.Show(adorner);
            }
            else
            {
                var adorner = element.GetAdorner();
                if (adorner != null)
                {
                    AdornerService.Remove(adorner);
                }

                element.ClearValue(AdornerProperty);
            }
        }
Exemplo n.º 2
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.");
         }
     }