XCAD.NET
XCAD.NET
Framework for .NET (C# and VB.NET) to create modern application for CAD systems (SOLIDWORKS, SOLIDWORKS Document Manager, Autodesk Inventor, etc.)
Get technical support Connect to xCAD community on Discord server Explore code and application examples xCAD.NET Templates for Visual Studio and VS Code Access source code

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:
            //handle command
            break;

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


Powered by Docify