Inspired by PropertyGrid Control in .NET Framework, SwEx.PMPage brings the flexibility of data model driven User Interface into SOLIDWORKS API.
Framework allows to use data model structure as a driver of the User Interface. Framework will automatically generate required interface and implement the binding of the model.
This will greatly reduce the implementation time as well as make the property pages scalable, easily maintainable and extendable.
Start by defining the data model required to be filled by property manager page.
public class DataModel
{
public string Text { get; set; }
public int Size { get; set; } = 48;
public double Number { get;set; } = 10.5;
}
Public Class DataModel
Public Property Text As String
Public Property Size As Integer = 48
Public Property Number As Double = 10.5
End Class
Create handler for property manager page by inheriting the public COM-visible class from PropertyManagerPageHandlerEx class.
This class will be instantiated by the framework and will allow handling the property manager specific events from the add-in.
[ComVisible(true)]
public class MyPMPageHandler : PropertyManagerPageHandlerEx
{
}
<ComVisible(True)>
Public Class MyPMPageHandler
Inherits PropertyManagerPageHandlerEx
End Class
Create instance of the property manager page by passing the type of the handler and data model instance into the generic arguments
private PropertyManagerPageEx<MyPMPageHandler, DataModel> m_MyPage;
private DataModel m_Data = new DataModel();
...
m_Page = new PropertyManagerPageEx<MyPMPageHandler, DataModel>(m_Data, m_App);
m_Page.Show();
Dim m_MyPage As PropertyManagerPageEx(Of MyPMPageHandler, DataModel)
Dim m_Data As DataModel = New DataModel()
...
m_Page = New PropertyManagerPageEx(Of MyPMPageHandler, DataModel)(m_Data, m_App)
m_Page.Show()
Refer documentation and API reference for more information about additional options.