UI.WPF.Modern icon indicating copy to clipboard operation
UI.WPF.Modern copied to clipboard

fix(Gallery): Fix navigation state mismatch and lost selection on search results page

Open PrefacedCorg opened this issue 7 months ago • 0 comments

Description

This pull request fixes core navigation state anomalies in the Gallery sample project, improves the robustness of the navigation logic, and syncs the latest code from the upstream main branch, with no breaking changes introduced.

Key Fixes & Improvements

  1. Fixed navigation state conflict risks: Refactored the page type validation logic in the OnRootFrameNavigated method, replacing independent if branches with a sequential, mutually exclusive if-else if structure. This prevents duplicate branch execution and repeated value assignment that could lead to state conflicts during a single navigation operation.
  2. Completed search results page state handling: Added a dedicated conditional branch for SearchResultsPage to properly record the page type to _lastItem, resolving the bug where the NavigationView selected item is lost or mismatched when navigating to/from the search results page via forward/backward operations.
  3. Optimized special page handling priority: Moved the SettingsPage validation branch to the front of the logic flow, prioritizing handling for special pages without corresponding navigation menu items, and preventing state from being incorrectly overwritten by subsequent branches.
  4. Synced upstream baseline: Merged the latest code from the iNKORE-NET:main branch to resolve branch differences and ensure this PR can be merged without conflicts.

Impact Scope

Only modifies the navigation root page code of the iNKORE.UI.WPF.Modern.Gallery sample project. No changes to the core library source code, no API alterations, and no breaking changes.

Validation & Testing

  • Verified navigation and backward/forward operations between the Settings Page and home/control pages, with NavigationView selection state syncing correctly
  • Verified navigation between the Search Results Page and other pages, with no selection mismatch or loss occurring
  • Validated original navigation logic for the All Controls Page, New Controls Page, and Section Pages, with no regression issues
  • Tested continuous navigation and backward operations across multiple pages, with navigation state remaining consistent and correct throughout the process

PrefacedCorg avatar May 02 '26 09:05 PrefacedCorg