private void WindowSizeChanged(object sender, WindowSizeChangedEventArgs e) { var pageViewModel = DataContext; if (pageViewModel == null) { return; } FrameworkElement frameworkElement; var pageLayout = PageLayoutProvider.DetermineVisualState(NarrowWidth); if (_viewCache.ContainsKey(pageLayout)) { frameworkElement = _viewCache[pageLayout]; } else { frameworkElement = ViewLocator.Resolve(pageViewModel, pageLayout); _viewCache.Add(pageLayout, frameworkElement); } Content = frameworkElement; ResetAppBarContentForView(frameworkElement); }
protected virtual string DetermineVisualState() { return(PageLayoutProvider.DetermineVisualState(NarrowWidth).ToString()); }