private void OnCurrentItemChanged(object sender, CurrentItemChangedEventArgs e) { if (sender is CarouselView carousel && carousel.CurrentItem != CurrentView && carousel.CurrentItem != null && carousel.CurrentItem is VisualElement newActiveView) { var previousView = CurrentView; CurrentView = newActiveView; if (!_region.ActiveViews.Contains(newActiveView)) { _region.Activate(newActiveView); } var info = PageNavigationRegistry.GetPageNavigationInfo(newActiveView.GetType()); var context = new NavigationContext(_region.NavigationService, new Uri(info.Name, UriKind.RelativeOrAbsolute)); MvvmHelpers.OnNavigatedFrom(previousView, context); MvvmHelpers.OnNavigatedTo(newActiveView, context); } }