SOLIDWORKS Property Manager Page data changed events handling

Edit ArticleEdit Article
Comments

SwEx framework provides event handlers for the data changes in the controls. Use this handlers to update preview or any other state which depends on the values in the controls.

Post data changed event

PropertyManagerPageHandlerEx::DataChanged event is raised after the user changed the value in the control which has updated the data model. Refer the bound data model for new values.

public class DataModel
{
    public string Text { get; set; }
}

private DataModel m_Data;

private PropertyManagerPageEx<MyPMPageHandler, DataModel> m_Page;

public override bool OnConnect()
{
    m_Data = new DataModel();
    m_Page = new PropertyManagerPageEx<MyPMPageHandler, DataModel>(App);

    m_Page.Handler.DataChanged += OnDataChanged;

    return true;
}

private void OnDataChanged()
{
    var text = m_Data.Text;
    //TODO: handle the data changing, e.g. update preview
}

Notifications

All articles and code at CodeStack are now open-source and hosted on GitHub. If you want to contribute by modifying existing articles and code snippets, submitting new ones, reporting errors and bugs etc. please follow this blog post for more information. We appreciate any contribution.


Product of Xarial Product of Xarial