diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/AppUIBasics.csproj b/Samples/XamlUIBasics/cs/AppUIBasics/AppUIBasics.csproj index 072e6e3fd4..e481adad7d 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/AppUIBasics.csproj +++ b/Samples/XamlUIBasics/cs/AppUIBasics/AppUIBasics.csproj @@ -10,8 +10,8 @@ AppUIBasics en-US UAP - 10.0.16190.0 - 10.0.16190.0 + 10.0.16232.0 + 10.0.16232.0 14 true 512 diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/NavigationViewPage.xaml b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/NavigationViewPage.xaml index af4263ee47..a51af71cb2 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/NavigationViewPage.xaml +++ b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/NavigationViewPage.xaml @@ -13,7 +13,7 @@ - diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/NavigationViewPage.xaml.cs b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/NavigationViewPage.xaml.cs index 37ec8406ed..9e11616c33 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/NavigationViewPage.xaml.cs +++ b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/NavigationViewPage.xaml.cs @@ -1,4 +1,5 @@ using AppUIBasics.SamplePages; +using System; using Windows.Foundation; using Windows.UI.Xaml.Controls; @@ -15,35 +16,22 @@ public NavigationViewPage() { this.InitializeComponent(); - AddMenuItem(Symbol.Play, "Menu Item1", NavigationMenuItem_Invoked); - AddMenuItem(Symbol.Save, "Menu Item2", NavigationMenuItem_Invoked_1); - AddMenuItem(Symbol.Refresh, "Menu Item3", NavigationMenuItem_Invoked_2); + AddMenuItem(Symbol.Play, "Menu Item1", typeof(SamplePage1)); + AddMenuItem(Symbol.Save, "Menu Item2", typeof(SamplePage2)); + AddMenuItem(Symbol.Refresh, "Menu Item3", typeof(SamplePage3)); } - private void AddMenuItem(Symbol icon, string text, TypedEventHandler handler) + private void AddMenuItem(Symbol icon, string text, Type pageType) { - var item = new NavigationMenuItem() { + var item = new NavigationViewItem() + { Icon = new SymbolIcon(icon), - Text = text }; - item.Invoked += handler; + Content = text, + Tag = pageType + }; nvSample.MenuItems.Add(item); } - private void NavigationMenuItem_Invoked(Windows.UI.Xaml.Controls.NavigationMenuItem sender, object args) - { - contentFrame.Navigate(typeof(SamplePage1)); - } - - private void NavigationMenuItem_Invoked_1(Windows.UI.Xaml.Controls.NavigationMenuItem sender, object args) - { - contentFrame.Navigate(typeof(SamplePage2)); - } - - private void NavigationMenuItem_Invoked_2(Windows.UI.Xaml.Controls.NavigationMenuItem sender, object args) - { - contentFrame.Navigate(typeof(SamplePage3)); - } - private void NavigationView_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { contentFrame.Navigate(typeof(SamplePage1)); @@ -54,9 +42,18 @@ private void rootGrid_SizeChanged(object sender, Windows.UI.Xaml.SizeChangedEven Example1.Width = e.NewSize.Width; } - private void NavigationView_SettingsInvoked(Windows.UI.Xaml.Controls.NavigationView sender, object args) + private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { - contentFrame.Navigate(typeof(SampleSettingsPage)); + if (args.IsSettingsSelected) + { + contentFrame.Navigate(typeof(SampleSettingsPage)); + } + else + { + var selectedItem = (NavigationViewItem)args.SelectedItem; + Type pageType = (Type)selectedItem.Tag; + contentFrame.Navigate(pageType); + } } } } diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RatingsControlPage.xaml b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RatingsControlPage.xaml index d2ba98579c..f113f3aeed 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RatingsControlPage.xaml +++ b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RatingsControlPage.xaml @@ -7,7 +7,7 @@ - @@ -32,7 +32,7 @@ - diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RevealPage.xaml b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RevealPage.xaml index 23671832c2..2c8796e83d 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RevealPage.xaml +++ b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RevealPage.xaml @@ -97,14 +97,14 @@ - - + + - <Grid BorderThickness="3" BorderBrush="{ThemeResource SystemControlRevealBorderListMediumBrush}"> + <Grid BorderThickness="3" BorderBrush="{ThemeResource SystemControlBackgroundListMediumRevealBorderBrush}"> <TextBlock Text="SystemControlRevealBorderChromeWhiteBrush" /> </Grid> diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/ItemPage.xaml.cs b/Samples/XamlUIBasics/cs/AppUIBasics/ItemPage.xaml.cs index a64d062cb6..240c1c6794 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/ItemPage.xaml.cs +++ b/Samples/XamlUIBasics/cs/AppUIBasics/ItemPage.xaml.cs @@ -132,7 +132,7 @@ private async void navigationHelper_LoadState(object sender, LoadStateEventArgs } ControlInfoDataGroup group = await ControlInfoDataSource.GetGroupFromItemAsync((String)e.NavigationParameter); - var menuItem = ((NavigationMenuItem)NavigationRootPage.Current.NavigationView.MenuItems.FirstOrDefault(m => m.Tag?.ToString() == group.UniqueId)); + var menuItem = NavigationRootPage.Current.NavigationView.MenuItems.Cast().FirstOrDefault(m => m.Tag?.ToString() == group.UniqueId); if (menuItem != null) { menuItem.IsSelected = true; @@ -285,7 +285,7 @@ private void svPanel_KeyDown(object sender, KeyRoutedEventArgs e) if (e.Key == VirtualKey.Up) { var nextElement = FocusManager.FindNextElement(FocusNavigationDirection.Up); - if (nextElement.GetType() == typeof(NavigationMenuItem)) + if (nextElement.GetType() == typeof(NavigationViewItem)) { NavigationRootPage.Current.PageHeader.Focus(FocusState.Programmatic); } diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/MainPage.xaml.cs b/Samples/XamlUIBasics/cs/AppUIBasics/MainPage.xaml.cs index 1781111525..6515c701e5 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/MainPage.xaml.cs +++ b/Samples/XamlUIBasics/cs/AppUIBasics/MainPage.xaml.cs @@ -170,7 +170,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) { navigationHelper.OnNavigatedTo(e); - var firstMenuItem = (NavigationMenuItem)NavigationRootPage.Current.NavigationView.MenuItems.FirstOrDefault(); + var firstMenuItem = (NavigationViewItem)NavigationRootPage.Current.NavigationView.MenuItems.FirstOrDefault(); if (firstMenuItem != null) firstMenuItem.IsSelected = true; diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/Navigation/NavigationRootPage.xaml b/Samples/XamlUIBasics/cs/AppUIBasics/Navigation/NavigationRootPage.xaml index 9caa78464a..49d774dbf0 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/Navigation/NavigationRootPage.xaml +++ b/Samples/XamlUIBasics/cs/AppUIBasics/Navigation/NavigationRootPage.xaml @@ -33,7 +33,7 @@ + SelectionChanged="NavigationView_SelectionChanged" Loaded="NavigationViewControl_Loaded"> ().Where(c => c.Name == "SettingsNavPaneItem").First().Margin = new Thickness(0); + NavigationViewControl.GetDescendantsOfType().Where(c => c.Name == "SettingsNavPaneItem").First().Margin = new Thickness(0); } @@ -204,7 +203,7 @@ void updateTitleBar() DeviceFamily = DeviceType.Mobile; BackButtonGrid.Visibility = Visibility.Collapsed; XboxContentSafeRect.Visibility = Visibility.Collapsed; - NavigationViewControl.GetDescendantsOfType().Where(c => c.Name == "SettingsNavPaneItem").First().Margin = new Thickness(0); + NavigationViewControl.GetDescendantsOfType().Where(c => c.Name == "SettingsNavPaneItem").First().Margin = new Thickness(0); } //xbox @@ -213,7 +212,7 @@ void updateTitleBar() DeviceFamily = DeviceType.Xbox; BackButtonGrid.Visibility = Visibility.Collapsed; XboxContentSafeRect.Visibility = Visibility.Visible; - NavigationViewControl.GetDescendantsOfType().Where(c => c.Name == "SettingsNavPaneItem").First().Margin = new Thickness(0, 0, 0, 40); + NavigationViewControl.GetDescendantsOfType().Where(c => c.Name == "SettingsNavPaneItem").First().Margin = new Thickness(0, 0, 0, 40); } } @@ -226,7 +225,7 @@ private async void LoadGroups() if (NavigationRootPage.Current != null) { - var menuItem = (NavigationMenuItem)NavigationRootPage.Current.NavigationView.MenuItems.FirstOrDefault(); + var menuItem = (NavigationViewItem)NavigationRootPage.Current.NavigationView.MenuItems.FirstOrDefault(); if (menuItem != null) menuItem.IsSelected = true; } @@ -235,27 +234,28 @@ private async void LoadGroups() GroupsLoaded(this, new EventArgs()); } - private void NavigationView_SettingsInvoked(NavigationView sender, object args) + private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { - rootFrame.Navigate(typeof(SettingsPage)); - } - - private void NavigationMenuItem_Invoked(NavigationMenuItem sender, object args) - { - if (sender == AllControlsMenuItem) + if (args.IsSettingsSelected) + { + rootFrame.Navigate(typeof(SettingsPage)); + } + else if (args.SelectedItem == AllControlsMenuItem) { rootFrame.Navigate(typeof(MainPage)); } - else if (sender == NewControlsMenuItem) + else if (args.SelectedItem == NewControlsMenuItem) { rootFrame.Navigate(typeof(NewControlsPage)); } else { - var itemId = ((ControlInfoDataGroup)sender.DataContext).UniqueId; + var selectedItem = (NavigationViewItem)args.SelectedItem; + var itemId = ((ControlInfoDataGroup)selectedItem.DataContext).UniqueId; rootFrame.Navigate(typeof(SectionPage), itemId); } } + private void rootFrame_Navigated(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e) { SetCustomBackButtonVisibility(); diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/NewControlsPage.xaml.cs b/Samples/XamlUIBasics/cs/AppUIBasics/NewControlsPage.xaml.cs index 9f02643977..c566a62cbb 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/NewControlsPage.xaml.cs +++ b/Samples/XamlUIBasics/cs/AppUIBasics/NewControlsPage.xaml.cs @@ -123,7 +123,7 @@ private void itemGridView_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRouted if (e.Key == Windows.System.VirtualKey.Up) { var nextElement = FocusManager.FindNextElement(FocusNavigationDirection.Up); - if (nextElement.GetType() == typeof(NavigationMenuItem)) + if (nextElement.GetType() == typeof(NavigationViewItem)) { pageHeader.Focus(FocusState.Programmatic); } diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/SectionPage.xaml.cs b/Samples/XamlUIBasics/cs/AppUIBasics/SectionPage.xaml.cs index 47ff03ae45..37be0e5584 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/SectionPage.xaml.cs +++ b/Samples/XamlUIBasics/cs/AppUIBasics/SectionPage.xaml.cs @@ -84,7 +84,7 @@ private async void navigationHelper_LoadState(object sender, LoadStateEventArgs var group = await ControlInfoDataSource.GetGroupAsync((String)e.NavigationParameter); Group = group; Bindings.Update(); - ((NavigationMenuItem)NavigationRootPage.Current.NavigationView.MenuItems.FirstOrDefault(m => m.Tag?.ToString() == group.UniqueId)).IsSelected = true; + NavigationRootPage.Current.NavigationView.MenuItems.Cast().FirstOrDefault(m => m.Tag?.ToString() == group.UniqueId).IsSelected = true; NavigationRootPage.Current.NavigationView.Header = group?.Title; }