WinUI-Gallery icon indicating copy to clipboard operation
WinUI-Gallery copied to clipboard

Child window sample forces parent window navigation

Open AndrewKeepCoding opened this issue 3 months ago • 1 comments

Which version of the app?

WinUI 3 Gallery

Description

Parent window navigates back to Home when creating a child window.

  1. Go to the Multiple windows sample page.
  2. Click the Create new Window button.
  3. Both parent and child window navigates to Home.

Screenshots

No response

Windows version

No response

Additional context

We shouldn't use MainWindow for the child window sample anymore.

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    ((NavigationViewItem)App.MainWindow.NavigationView.MenuItems.First()).IsSelected = true;
    ...

AndrewKeepCoding avatar Oct 01 '25 02:10 AndrewKeepCoding

I can update the samples and replace MainWindow with a plain Window, given the green light. 🙂

AndrewKeepCoding avatar Oct 01 '25 02:10 AndrewKeepCoding