コード例 #1
0
ファイル: DropBehavior.cs プロジェクト: BadKarmaZen/WireMe
        void MakeAdorner(UIElement uiElement, object data, object target, bool isOpening, bool canDrop, string message)
        {
            // get adorner layer
            FrameworkElement el = this.AssociatedObject;

            while (el != null && (!(el is UserControl) || AdornerLayer.GetAdornerLayer(el) == null))
            {
                el = (FrameworkElement)VisualTreeHelper.GetParent(el);
            }

            if (el != null)
            {
                _adornerLayer = AdornerLayer.GetAdornerLayer(el);

                // make adorner
                if (AdornerType == null)
                {
                    _adorner = new DropAdorner(uiElement, data, target, isOpening, canDrop, message);
                }
                else
                {
                    _adorner = (System.Windows.Documents.Adorner)Activator.CreateInstance(AdornerType, new object[] { uiElement, data, target, isOpening, canDrop, message });
                }

                _adornerLayer.Add(this._adorner);

                // set adorner z-order
                var setZOrderMethodInfo = _adornerLayer.GetType().GetMethod("SetAdornerZOrder", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                setZOrderMethodInfo.Invoke(_adornerLayer, new object[] { _adorner, 1 });
            }
        }
コード例 #2
0
ファイル: AdornedControl.cs プロジェクト: Abishai2007/actools
 /// <summary>
 /// Update adorner’s order.
 /// </summary>
 private void UpdateOrder()
 {
     if (_adornerLayer == null || _adorner == null)
     {
         return;
     }
     try {
         _adornerLayer.GetType().GetMethod("SetAdornerZOrder", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
         .Invoke(_adornerLayer, new object[] { _adorner, Order });
     } catch {
         // ignored
     }
 }