XCAD.NET
XCAD.NET
Framework for .NET (C# and VB.NET) to create modern application for CAD systems (SOLIDWORKS)
Get technical support Access source code Explore code and application examples

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

Custom controls rendered in Task Pane
Custom controls rendered in 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:
            //TODO: handle command
            break;

        case TaskPaneCommands_e.Close:
            m_TaskPane.Close();
            break;
    }
}


Powered by Docify