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; } }
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); } } } }