I am wondering do you use Property Pages for your UI or do you fall back to Windows/WPF forms?
I have rarely used Property Manager Pages as it is too costly to design ones and especially maintaining creating the right data binding. Later I have developed an xCAD.NET framework where Property Page can be created in seconds just based on the data model and it will be automatically bound both ways to the data model. No need to create controls, property manager page handlers, maintain ids, etc.
I have published a detailed tutorial that covers all the aspects of creating and binding property manager pages using xCAD. Hope it can be useful: Build modern SOLIDWORKS Property Manager Pages with an ease - YouTube
I use them on regular basis as it gives me native SolidWorks feeling.
I have also watched your video on YouTube but haven’t got a chance to look at the framework yet.
As usual, you’re doing great work for the community.
Thank you @nilesh. I am with you here regarding the native look and feel. I especially like NumberBox control with units and SelectionBox as those are hard to replicate in Win Forms controls.
@artem You are absolutely right about PropertyManager Pages (PMP) being time costly to develop. Xcad brings some well-needed productivity in that regard.
The only reason, I’d use a PMP over a taskpane is if what I’m doing involves selection. The PMPSelectionBox is definitely a convenient control.
I also like NumberBox where you can enable units and it will render depending on document units while still binding everything in system units. And you can also do formulas.
My understanding is that m_pmp object gets generated at start-up and on m_pmp.Show() gets repainted on screen. is it true that solidworks looks into the members of this object and repaint the checkboxes, seleciton boxes etc?
If that is correct when our controllers are on DataMoel how does solidworks find them during the Show() method?
Hamed, I am not sure I understand your question. Do you refer to how SW works with property pages in general or in particular how xCAD.NET works?
Sorry for that , let me rephrase it then.
I know that SW makes a PMP through calling CreatePropertyManagerPage Method (ISldWorks) in an imaginary
class A. And that we have to make an instance of this class in our add-ins when the
OnConnectToSW() is called.
Class A has a private field of type
I thought SW would use this field every time a
.Show() is called to repaint the button on a property manager page.
In other words doesn’t SW need the field in that specific instance of
class A? hence by moving it into another object it might not find it ?
Thank you for the clarification, I understand your question now. You do not need to place your property page in the separate class (this is just the default example in the add-in, but you can avoid that.) likewise declaring the button will not generate control, rather the call to AddControl API does. You can declare buttons anywhere as public, private etc. and as long as you call AddControl - this will work.
@hamed Expanding on what @artem is saying, PMP can get very long. I highly suggest separating them into multiple files (one for each feature) using partial classes.