lepoco / lepoco/wpfui

NavigationItem wrongly activated

Open
#306 0 comments 0 reactions 1 assignee View on GitHub

@pomianowski is already working on this.

Since Jul 27, 2022.

  • #355 by @pomianowski — merged
bug more_info_needed
Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
NavigationItem has a weird behavior if two or more NavigationItem share the same PageType.

To Reproduce

<wpfui:NavigationFluent.Items>
    <wpfui:NavigationItem Tag="home" PageType="{x:Type pages:HomePage}">Home</wpfui:NavigationItem>
    <wpfui:NavigationItem Tag="edit-a.txt" PageType="{x:Type pages:EditorPage}">a.txt</wpfui:NavigationItem>
    <wpfui:NavigationItem Tag="edit-b.txt" PageType="{x:Type pages:EditorPage}">b.txt</wpfui:NavigationItem>
</wpfui:NavigationFluent.Items>

If you click on b.txt, "a.txt" will be activated. If they both called "a.txt", even with different tag, they will be activated.

Expected behavior
NavigationItem should be activated distinctly by its tag, not page type

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows 10]
  • .NET: [e.g. net5.0-windows10.0.17763.0]
  • Version: [e.g. 1.0.4-prerelease45]

Additional context
I want to learn more about how to add(and remove, if can) NavigationItem dynamically and inject ViewModels individually. An example is a text editor, you open a file, it creates a NavigationItem and navigate to the file.

In UWP, it is possible by overriding OnNavigatedTo(NavigationEventArgs e) and call e.Parameter.

Current PageService, NavigationService are too complicated to use, and not supporting navigation parameter.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.