private void UserControl_Unloaded(object sender, RoutedEventArgs e) { MainContent.RemoveHandler(UIElement.TappedEvent, MainContentTappedHandler); MainContentTappedHandler = null; foreach (var c in LeftContent) { if (c is SidebarItem sb) { sb.PropertyChanged -= LeftItemPropertyChanged; } } foreach (var c in RightContent) { if (c is SidebarItem sb) { sb.PropertyChanged -= RightItemPropertyChanged; } } LeftContent = null; RightContent = null; }