Hello,
I dynamically create UserControls using Reflection: UserControl myConmtrol = (UserControl)Activator.CreateInstance(t);
The UserControl may handle a Closing event but I do not know the name of the handler.
When the Window hosting the UserControl closes I remove the UserControl from its parent Window and it disappears from the Window: Everything seems OK.
But if I open and close again the UserControl I can see in the debugger the Closing event is handled twice, one time by the current UserControl but also by the previous UserControl that is still alive.
Theorically the UserControl being no longer referenced should be GarbageCollected. How can I force it to be Killed/Deleted/Disposed ? At least is there a way to forbid it handles events ?
Thanks