forked from Kinnara/ModernWpf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NavigationView: Fix overflow button not being collapsed when the over…
…flow menu only contains one item and NavigationView menu items are removed to empty the overflow menu (microsoft/microsoft-ui-xaml#3087)
- Loading branch information
Showing
8 changed files
with
144 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
test/NavigationView_TestUI/TopMode/NavigationViewTopNavOverflowButtonPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> | ||
<local:TestPage | ||
x:Class="MUXControlsTestApp.NavigationViewTopNavOverflowButtonPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:MUXControlsTestApp" | ||
xmlns:muxcontrols="http://schemas.modernwpf.com/2019" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d"> | ||
|
||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" | ||
HorizontalAlignment="Left"> | ||
<!-- The width and number of NavigationView menu items have been set in such a way that the overflow menu button | ||
is visible and the overflow menu only contains a single item. --> | ||
<muxcontrols:NavigationView x:Name="NavView" | ||
PaneDisplayMode="Top" | ||
IsBackButtonVisible="Collapsed" | ||
MinWidth="100" Width="499"> | ||
<muxcontrols:NavigationView.MenuItems> | ||
<muxcontrols:NavigationViewItem Content="Menu Item 1"/> | ||
<muxcontrols:NavigationViewItem Content="Menu Item 2" /> | ||
<muxcontrols:NavigationViewItem Content="Menu Item 3"/> | ||
<muxcontrols:NavigationViewItem Content="Menu Item 4"/> | ||
</muxcontrols:NavigationView.MenuItems> | ||
</muxcontrols:NavigationView> | ||
|
||
<StackPanel Orientation="Horizontal" Margin="8,10,0,0"> | ||
<Button x:Name="AddItem4Button" AutomationProperties.Name="AddItem4Button" Click="AddItem4Button_Click" Margin="5,0,0,0" Content="Add Menu Item 4"/> | ||
<Button x:Name="RemoveFirstItemButton" AutomationProperties.Name="RemoveFirstItemButton" Click="RemoveFirstItemButton_Click" Margin="5,0,0,0" Content="Remove First Item"/> | ||
<Button x:Name="RemoveLastItemButton" AutomationProperties.Name="RemoveLastItemButton" Click="RemoveLastItemButton_Click" Margin="5,0,0,0" Content="Remove Last Item"/> | ||
</StackPanel> | ||
</StackPanel> | ||
</local:TestPage> |
43 changes: 43 additions & 0 deletions
43
test/NavigationView_TestUI/TopMode/NavigationViewTopNavOverflowButtonPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System.Windows; | ||
|
||
using NavigationViewItem = ModernWpf.Controls.NavigationViewItem; | ||
|
||
namespace MUXControlsTestApp | ||
{ | ||
public sealed partial class NavigationViewTopNavOverflowButtonPage : TestPage | ||
{ | ||
public NavigationViewTopNavOverflowButtonPage() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
private void AddItem4Button_Click(object sender, RoutedEventArgs e) | ||
{ | ||
var menuItem = new NavigationViewItem | ||
{ | ||
Content = $"Menu Item 4", | ||
}; | ||
|
||
this.NavView.MenuItems.Add(menuItem); | ||
} | ||
|
||
private void RemoveFirstItemButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (NavView.MenuItems.Count > 0) | ||
{ | ||
NavView.MenuItems.RemoveAt(0); | ||
} | ||
} | ||
|
||
private void RemoveLastItemButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (NavView.MenuItems.Count > 0) | ||
{ | ||
NavView.MenuItems.RemoveAt(NavView.MenuItems.Count - 1); | ||
} | ||
} | ||
} | ||
} |