Hi All,
This is probably not specifically a WPF question but I am working in WPF at the moment. I will take a stab at explaining what I am trying to do.
I have a main window where I am adding user controls (views) dynamically. I am using an MVVM pattern and thus every view has a ViewModel class. The Main Window View Model keeps track of each view that is added dynamically and when it is closed and these are kept in a collection. Since I have the need to add a view from another view such as one form calling another form I need to notify the main window View Model via an event that I want to add another view. This event is implemented in a base class. so all views have the ability to raise the event notifying the main window ViewModel to add that view.
Here is my question. If I add a view that can raise the event, I subscribe to the event at that time. But when the view is closed or removed from the collection I would need to unsubscribe to the event. This event is sort of generic so can it be subscribed multiple times? If I load a view and subscribe to the event, then another view is loaded and the event is subscribed again. Is this subscription additive? If I remove a view and unsubscribe, will it still be listening to the second view that also subscribed.
Tim
Timothy Bryan