A tool that creates a component.
Inheritance: ITool
Esempio n. 1
0
        protected override void OnMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (hasDragStarted)
            {
                if (operation != null)
                {
                    operation.Commit();
                    operation = null;
                }
            }
            else
            {
                CreateComponentTool.AddItemWithDefaultSize(container, createdItem, e.GetPosition(positionRelativeTo));
            }
            if (changeGroup != null)
            {
                changeGroup.Commit();
                changeGroup = null;
            }

            if (designPanel.Context.Services.Component is XamlComponentService)
            {
                ((XamlComponentService)designPanel.Context.Services.Component).RaiseComponentRegisteredAndAddedToContainer(createdItem);
            }

            base.OnMouseUp(sender, e);
        }
Esempio n. 2
0
 private void lstControls_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     var item = lstControls.SelectedItem as ToolBoxItem;
     if (item != null)
     {
         var tool = new CreateComponentTool(item.Type);
         designSurface.DesignPanel.Context.Services.Tool.CurrentTool = tool;
     }
 }
Esempio n. 3
0
 private void lstControls_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     var item = lstControls.SelectedItem as ToolBoxItem;
     if (item != null)
     {
         var tool = new CreateComponentTool(item.Type);
         designSurface.DesignPanel.Context.Services.Tool.CurrentTool = tool;
     }
 }
 private void lstControls_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (sender is ListBoxItem)
     {
         ListBoxItem draggedItem = sender as ListBoxItem;
         draggedItem.IsSelected = true;
         var itm = draggedItem.Content as ToolBoxItem;
         var tool = new CreateComponentTool(itm.Control);
         DragDrop.DoDragDrop(this, tool, DragDropEffects.Copy);
     }
 }
 void PrepareTool(ControlNode node, bool drag)
 {
     if (node != null) {
         var tool = new CreateComponentTool(node.Type);
         if (Shell.Instance.CurrentDocument != null) {
             Shell.Instance.CurrentDocument.DesignContext.Services.Tool.CurrentTool = tool;
             if (drag) {
                 DragDrop.DoDragDrop(this, tool, DragDropEffects.Copy);
             }
         }
     }
 }
        void PrepareTool(MyFooNode node, bool drag)
        {
            if (node != null)
            {

                //Get the Type we want to use for the MyFooNode being dragged out here.
                Type type = GetTypeForFooType(node.FooType);

                var tool = new CreateComponentTool(type);
                if (MyDesignerModel.Instance.DesignSurface != null)
                {
                    MyDesignerModel.Instance.DesignSurface.DesignContext.Services.Tool.CurrentTool = tool;
                    if (drag)
                    {
                        DragDrop.DoDragDrop(this, tool, DragDropEffects.Copy);
                    }
                }
            }
        }
 protected override void OnMouseUp(object sender, MouseButtonEventArgs e)
 {
     if (hasDragStarted)
     {
         if (operation != null)
         {
             operation.Commit();
             operation = null;
         }
     }
     else
     {
         CreateComponentTool.AddItemWithDefaultSize(container, createdItem, e.GetPosition(positionRelativeTo));
     }
     if (changeGroup != null)
     {
         changeGroup.Commit();
         changeGroup = null;
     }
     base.OnMouseUp(sender, e);
 }
Esempio n. 8
0
        public static bool AddItemWithDefaultSize(DesignItem container, Type createdItem, Size size)
        {
            CreateComponentTool cct = new CreateComponentTool(createdItem);

            return(AddItemWithCustomSize(container, cct.CreateItem(container.Context), new Point(0, 0), size));
        }
Esempio n. 9
0
        public static bool AddItemWithCustomSizePosition(DesignItem container, Type createdItem, Size size, Point position)
        {
            CreateComponentTool cct = new CreateComponentTool(createdItem);

            return(AddItemWithCustomSize(container, cct.CreateItem(container.Context), position, size));
        }
Esempio n. 10
0
		public static bool AddItemWithDefaultSize(DesignItem container, Type createdItem, Size size)
		{
			CreateComponentTool cct = new CreateComponentTool(createdItem);
			return AddItemWithCustomSize(container, cct.CreateItem(container.Context), new Point(0, 0), size);
		}
Esempio n. 11
0
		public static bool AddItemWithCustomSizePosition(DesignItem container, Type createdItem, Size size, Point position)
		{
			CreateComponentTool cct = new CreateComponentTool(createdItem);
			return AddItemWithCustomSize(container, cct.CreateItem(container.Context), position, size);
		}