- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a conceptual question for those who are experienced with WPF dockable panes with MVVM design pattern.
I have an application that has the following sequence:
WPF modeless dockable pane stores selection data via text boxes and comboboxes as properties for an application.
The user selects(combobox) or inputs(textbox) the desired properties.
The user clicks a command button on my custom Ribbon.
The application retrieves the information from the viewmodel, and performs the function based on the viewmodel data.
To date (which I knew was wrong from the beginning....), I have been storing the viewmodel data in a Singleton instance so that I can consistently retrieve the information from the Revit command. The WPF form is databound to the instance so they remain in sync. This works great provided there are not two different Revit Documents open in the application window. As soon as I move between two different documents, the data in the viewmodel does not stay in sync with the document that I'm working in (obviously....)
I feel certain I can work this out by storing Revit Document instances and associated viewmodel instances as documents are open using a DocumentOpeneded event. However, I am curious for those who have doing this much longer than I have if there is a good standard of practice / pattern I should consider to ensure viewmodel data can stay in sync with the current Document.
Thank you,
Jason
Solved! Go to Solution.