diff --git a/src/Uno.Extensions.Navigation.UI/Navigators/NavigationViewNavigator.cs b/src/Uno.Extensions.Navigation.UI/Navigators/NavigationViewNavigator.cs index c4646adb8c..f8cded7b52 100644 --- a/src/Uno.Extensions.Navigation.UI/Navigators/NavigationViewNavigator.cs +++ b/src/Uno.Extensions.Navigation.UI/Navigators/NavigationViewNavigator.cs @@ -19,7 +19,7 @@ public override void ControlInitialize() // Make sure selectionchanged event handlers are wired up base.ControlInitialize(); - if(Control?.SelectedItem is not null) + if (Control?.SelectedItem is not null) { _ = SelectionChanged(Control, MenuItemToFrameworkElement(Control.SelectedItem)); } @@ -71,13 +71,17 @@ private object[] NavigationMenuItems return Array.Empty(); } + static IEnumerable GetItems(object source, IEnumerable items) => + (source as IEnumerable)?.OfType() ?? + items?.OfType() ?? + Array.Empty(); - if (Control.MenuItemsSource is IEnumerable items) - { - return items.OfType().ToArray(); - } + var allitems = Enumerable.Concat( + GetItems(Control.MenuItemsSource, Control.MenuItems), + GetItems(Control.FooterMenuItemsSource, Control.FooterMenuItems) + ).ToArray(); - return Control.MenuItems.ToArray(); + return allitems; } } diff --git a/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundPage.xaml b/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundPage.xaml index 73a29b0ab7..55a5a55183 100644 --- a/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundPage.xaml +++ b/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundPage.xaml @@ -10,7 +10,6 @@ xmlns:utu="using:Uno.Toolkit.UI" xmlns:muxc="using:Microsoft.UI.Xaml.Controls" Background="LightBlue"> - @@ -38,6 +37,7 @@ SelectedItem="{Binding SelectedNavigationItem, Mode=TwoWay}" ItemInvoked="NavigationItemInvoked" MenuItemsSource="{Binding NavigationItems}" + FooterMenuItemsSource="{Binding FooterItems}" IsSettingsVisible="True"> diff --git a/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundPage.xaml.cs b/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundPage.xaml.cs index 070a948671..2083fbc63f 100644 --- a/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundPage.xaml.cs +++ b/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundPage.xaml.cs @@ -11,7 +11,7 @@ public NavigationViewDataBoundPage() public void NavigationItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs e) { - if(e.InvokedItemContainer == sender.SettingsItem as Microsoft.UI.Xaml.Controls.NavigationViewItem) + if (e.InvokedItemContainer == sender.SettingsItem as Microsoft.UI.Xaml.Controls.NavigationViewItem) { this.Navigator()!.NavigateViewModelAsync(this); } diff --git a/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundViewModel.cs b/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundViewModel.cs index bea288844d..24b609529b 100644 --- a/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundViewModel.cs +++ b/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewDataBoundViewModel.cs @@ -1,11 +1,13 @@ namespace TestHarness.Ext.Navigation.NavigationView; +[ReactiveBindable(false)] public partial class NavigationViewDataBoundViewModel : ObservableObject { [ObservableProperty] private string selectedNavigationItem = "Deals"; - public string[] NavigationItems { get; } = new string[] { "Products", "Deals", "Profile" }; + public string[] NavigationItems { get; } = ["Products", "Deals"]; + public string[] FooterItems { get; } = ["Profile"]; public void SelectProfile() { diff --git a/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewHomePage.xaml b/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewHomePage.xaml index 17cb970cc5..0c9e36dfdc 100644 --- a/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewHomePage.xaml +++ b/testing/TestHarness/TestHarness.Shared/Ext/Navigation/NavigationView/NavigationViewHomePage.xaml @@ -35,10 +35,13 @@ + + + - +