Following the MVVM pattern, I am trying to connect the display of a child window by view in response to a request from a view model.
Using MVVM-Light Messenger, View will register a request to display the child window in the view designer like this:
InitializeComponent(); Messenger.Default.Register<EditorInfo>(this, (editorData) => { ChildWindow editWindow = new EditWindow(); editWindow.Closed += (s, args) => { if (editWindow.DialogResult == true) // Send data back to VM else // Send 'Cancel' back to VM }; editWindow.Show(); });
Does the ChildWindow Closed event subscribe using the Lambda garbage collection problem. Or in another way, when (if ever), editWindow will become unreferenced and therefore a candidate for garbage collection.
c # event-handling silverlight mvvm-light
Ralph shillington
source share