Closed RyanPatrickDaley closed 1 year ago
I ended up putting the DocumentChanged event in the Constructor for the UI.Xaml.Cs, and it is working fine. I'm not sure if this is ideal, but it does work
public Ui(UIApplication uiApp, EventHandlerWithWindowArg evExternalMethodStringArg, ControlledApplication m_CtrlApp)
{
_uiDoc = uiApp.ActiveUIDocument;
_doc = _uiDoc.Document;
_uiApp = uiApp;
Closed += MainWindow_Closed;
InitializeComponent();
DataModel = new ViewModel();
this.DataContext = DataModel;
m_CtrlApp.DocumentChanged += new EventHandler<Autodesk.Revit.DB.Events.DocumentChangedEventArgs>(CtrlApp_DocumentChanged);
}
@mitevpi , In the context of this WPF template, where should Revit EventHandlers be placed? For example, I am trying to use the Application.DocumentChanged event. Where should this be in order to be in the "Valid Revit API Context?"