Navigation fails/ refuses to work if removed and re-added from SpliView.Pane
See original GitHub issueDescribe the bug
When a WinUI NavigationView
is inside a Splitview.Pane
, removing and re-adding it in runtime stops it’s navigation behavior.
Steps to reproduce the bug
Simplest steps to reproduce the behavior:
- Create a blank UWP/C# app
- Add WinUI nuget package (Microsoft.UI.Xaml)
- Edit App.Xaml to add WinUI:
<Application
x:Class="Test2.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Test2">
<Application.Resources>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
</Application.Resources>
</Application>
- Add a SplitView in MainPage.xaml. Add WinUI NavigationView inside the pane of the SpliView. Add a button in the Splitview.Content which will add/remove the NavigationView from SpliView.Pane.
MainPage.xaml:
<Page
x:Class="Test2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Test2"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:WinUI="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<SplitView x:Name="Split" DisplayMode="Inline" IsPaneOpen="True">
<SplitView.Pane>
<WinUI:NavigationView x:Name="NavView" IsSettingsVisible="False" IsBackButtonVisible="Collapsed" PaneDisplayMode="Top">
<WinUI:NavigationView.MenuItems>
<WinUI:NavigationViewItem Content="item 1"/>
<WinUI:NavigationViewItem Content="item 2"/>
</WinUI:NavigationView.MenuItems>
</WinUI:NavigationView>
</SplitView.Pane>
<Button Content="Add/Remove NavigationView" Click="Button_Click"/>
</SplitView>
</Grid>
</Page>
MainPage.xaml.cs:
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Test2
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (Split.Pane is null)
Split.Pane = NavView;
else Split.Pane = null;
}
}
}
- Build and Run the app. Tap on the navigation items (Item1 and Item2) to ensure that everything works fine.
- Remove and Re-add the NavigationView by pressing the Add/Remove NavigationView Button twice.
- Now try the navigation items again. It doesn’t work !
Expected behavior Normal navigation behavior.
Version Info
NuGet package version: Microsoft.UI.Xaml 2.0.181018003
Windows 10 version:
- October 2018 Update (17763)
Device form factor:
- Desktop
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
UISplitViewController broken when in tab view controllers
I'm trying to rebasline my app to iOS 14. My app's main entry point for the UI is a tab view controller. Three...
Read more >The splitview is not opening on debugging
I am using Visual Studio 2015 and learning making UWP Apps. I want to make hamburger style navigation but the splitview doesn't open...
Read more >Slack confirmed, split view has been deprecated. Windows ...
Split view let you have a thread open and it would persist as a side bar when navigating away from the channel the...
Read more >Using the UWP SplitView on iOS, Android and WebAssembly ...
In this post we're going to cover one of the basics of app navigation which is the use of the UWP SplitView. If...
Read more >Navigation and the back stack
The back stack is useful for when the user wants to navigate backwards. Android can remove the current activity from the top of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @MuziburRahman , thank you for the explanation and screenshot! If Pivot is accomplishing what you need it to, that’s great and please continue using Pivot. If things still aren’t working to your liking, you can also look into using the Windows Community Toolkit’s TabView control.
Muzib,
Thank you for reporting this, and I can reproduce your problem. Will let you if we have update.
You may workaround the problem by collapsing navigationview other than removing/re-adding.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: Muzib notifications@github.com Sent: Tuesday, November 13, 2018 9:59:27 PM To: Microsoft/microsoft-ui-xaml Cc: Subscribed Subject: [Microsoft/microsoft-ui-xaml] Navigation fails/ refuses to work if removed and re-added from SpliView.Pane (#18)
Describe the bug When a WinUI NavigationView is inside a Splitview.Pane, removing and re-adding it in runtime stops it’s navigation behavior.
Steps to reproduce the bug
Simplest steps to reproduce the behavior:
<Application x:Class="Test2.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Test2">
</Application>MainPage.xaml:
<Page x:Class="Test2.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Test2" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:WinUI="using:Microsoft.UI.Xaml.Controls" mc:Ignorable="d" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
</Page>MainPage.xaml.cs:
using Windows.UI.Xaml; using Windows.UI.Xaml.Controls;
namespace Test2 { public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); }
}
Expected behavior Normal navigation behavior.
Version Info
NuGet package version: Microsoft.UI.Xaml 2.0.181018003
Windows 10 version:
Device form factor:
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/microsoft-ui-xaml/issues/18, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF_9BOKHaUKe2AqDX2T-sA5pDdtzip83ks5uu7E_gaJpZM4YdE5y.