I need to write functionality such that if the user leaves the UserControl
(i.e. navigates away from the control), I need to save the data which resides in the view model of the user control.
I've tried connecting a handler to the Unloaded
event of the user control, but I'm unable to access the DataContext
.
Is there a way by which I can capture the event so I can save the data of the view model associated with the user control.