Adding custom Windows Forms and WPF control into SOLIDWORKS Task Pane using xCAD
xCAD framework allows to add custom Windows Forms controls and WPF controls into Task Pane View.
Decorate the control classes with TitleAttribute and IconAttribute to assign tooltip and icon.
Simple Task Pane
Taskpane can be created by calling the method below. Pointer to IXTaskPane provides an access to underlying properties and the pointer to the created control.
var taskPane = CreateTaskPane<WinFormControl>();
WinFormControl control = taskPane.Control;
Commands Task Pane
Additionally task pane can contain custom command buttons.
public enum TaskPaneCommands_e { [Title("Task Pane Command")] [Icon(typeof(Resources), nameof(Resources.command1))] Command, [TaskPaneStandardIcon(TaskPaneStandardIcons_e.Close)] Close } private IXTaskPane<WpfControl> m_TaskPane;
var cmdTaskPane = this.CreateTaskPane<WpfControl, TaskPaneCommands_e>(); cmdTaskPane.ButtonClick += OnTaskPaneButtonClick; m_TaskPane = cmdTaskPane;
private void OnTaskPaneButtonClick(TaskPaneCommands_e spec) { switch (spec) { case TaskPaneCommands_e.Command: //handle command break; case TaskPaneCommands_e.Close: m_TaskPane.Close(); break; } }