In my WPF MVVM application, I am subscribing to PreviewKeyUp and PreviewKeyDown in UserControl1.xaml.cs as such:
UserControl1_Loaded(object sender, RoutedEventArgs e)
{
var window = Window.GetWindow(this);
window.PreviewKeyUp += UserControl1_PreviewKeyUp;
window.PreviewKeyDown += UserControl1_PreviewKeyDown;
}
Should I worry about a memory leak? Do I have to unsubscribe from these events in the Unloaded event or will the GC take care of it?