5 Replies Latest reply on Aug 5, 2013 10:28 AM by Louis Bouchard

    C# Add-in: Creating a taskpane in WPF instead of WinForms

    Louis Bouchard

      I followed the tutorial from AngelSix to create an add-in in C#, and it worked perfectly, all is well... almost.  The tutorial uses WinForms to make the taskpane, but I would rather use WPF because it makes it easier implement a MVVM pattern with property change events and  commands.


      I tried to simply substitute the SWTaskpaneHost WinForms user control to a WPF usercontrol with just a simple label on it. I made it 'COM Visible' and gave it a ProgID, eveything compiled just fine, but when I fire up SolidWorks, the new TaskPane is there, but it is never drawn.  If I switch from another TaskPane to mine, the previous layout remains visible (but not "clickable").  I know that the WPF usercontrol is created (I put a message box in it's constructor) and I can see the title at the top of the pane is the one I specified.


      I looked at this: http://help.solidworks.com/2012/english/api/sldworksapi/add_.net_controls_to_solidworks_using_an_add-in_example_csharp.htm but the TaskPane is in WinForms there too.


      Has anyone tried this?  I'm a bit at a loss here..