コード例 #1
0
 private void OnMouseLeave(object sender, MouseEventArgs e)
 {
     if (_adornerLayer != null && _adorner != null && !(base.AssociatedObject.IsChecked.HasValue && base.AssociatedObject.IsChecked.Value))
     {
         _adorner.RemoveChild();
         _adornerLayer.Remove(_adorner);
         _adorner      = null;
         _adornerLayer = null;
     }
 }
コード例 #2
0
        private void OnMouseEnter(object sender, MouseEventArgs e)
        {
            if (this.Content != null && _adorner == null)
            {
                Control control = new Control();
                control.Template    = this.Content;
                control.DataContext = base.AssociatedObject.DataContext;

                _adorner           = new ControlAdorner(base.AssociatedObject, control);
                _adorner.Placement = this.Placement;
                _adorner.OffsetX   = this.OffsetX;
                _adorner.OffsetY   = this.OffsetY;

                _adorner.PositionX = this.PositionX;
                _adorner.PositionY = this.PositionY;

                _adornerLayer = AdornerLayer.GetAdornerLayer(base.AssociatedObject);
                _adornerLayer.Add(_adorner);
            }
        }