示例#1
0
 public override void DesignMode()
 {
     if (!IsDesignMode)
     {
         AdornerLayer = new Adorner(this);
         AdornerLayer.Selected += OnSelected;
         AdornerLayer.IsLockScale = true;
         var menu = new ContextMenu();
         var menuItem = new MenuItem() { Header = "属性" };
         menuItem.Click += PropertyMenuItem_Click;
         menu.Items.Add(menuItem);
         AdornerLayer.SetValue(ContextMenuService.ContextMenuProperty, menu);
     }
 }
示例#2
0
        public override void DesignMode()
        {
            if (!IsDesignMode)
            {
                AdornerLayer = new Adorner(this);
                AdornerLayer.Selected += OnSelected;

                var menu = new ContextMenu();
                var menuItem = new MenuItem() { Header = "属性" };
                menuItem.Click += PropertyMenuItem_Click;
                menu.Items.Add(menuItem);
                AdornerLayer.SetValue(ContextMenuService.ContextMenuProperty, menu);
                this.SetValue(ContextMenuService.ContextMenuProperty, menu);
                AdornerLayer.Editabled = true;
                _grid.Children.Add(_moveImage);
            }
        }