NavigationItem wrongly activated
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.