Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the NavigationView's SelectedItem is set after having set the ItemsSource the NavigationViewItem is not selected. #9185

Closed
Suriman opened this issue Dec 23, 2023 · 6 comments
Labels
area-NavigationView NavView control bug Something isn't working team-Controls Issue for the Controls team

Comments

@Suriman
Copy link

Suriman commented Dec 23, 2023

Describe the bug

When setting the SelectedItem of a NavigationView after having set the ItemsSource, the NavigationViewItem which has to be selected doesn't select.

Steps to reproduce the bug

1 - Open the attached sample and compile it.
2 - Execute the NavigationViewSelectionDisappears.Windows project as Package.
3 - You'll see that the NavigationViewItem is not selected.

Expected behavior

The NavigationViewItem has to be selected.

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

@Suriman Suriman added the bug Something isn't working label Dec 23, 2023
@Suriman
Copy link
Author

Suriman commented Dec 23, 2023

Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 23, 2023
@kmgallahan
Copy link
Contributor

kmgallahan commented Dec 23, 2023

IMO, you should provide a minimal repro sample rather than a large multi-platform project with many extraneous references.

~I couldn't run it unless I installed things I have no use for.

@Suriman
Copy link
Author

Suriman commented Jan 3, 2024

@kmgallahan, I attach the solution with the Windows target framework only.
NavigationViewItemIsSelectedValueWindowsOnly.zip

@kmgallahan
Copy link
Contributor

kmgallahan commented Jan 3, 2024

This is not a minimal repro:

    <PackageReference Include="Uno.Resizetizer" Version="1.2.1" />
    <PackageReference Include="Uno.WinUI" Version="5.0.48" />
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
    <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
    <PackageReference Include="Uno.Material.WinUI" Version="4.0.6" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
    <PackageReference Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
    <PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.48" />
    <PackageReference Include ="Prism.Core" Version="8.1.97"/>

This is a minimal repro from making a new app from the standard template and copying over bits of your code:

https://github.com/kmgallahan/NavSelectedItemSample

and it shows the NavigationView working as expected.

You should start eliminating or adding dependencies and complications in a test project until you find what is causing your problem.

Edit: I'm guessing it a problem with the uno skin / style implementation.

@bpulliam bpulliam added area-NavigationView NavView control team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jan 5, 2024
@gegao18
Copy link

gegao18 commented Jan 23, 2024

Thanks for reporting this @Suriman, and thanks @kmgallahan for investigating. I'm closing this for now since it seems to be an external issue. Please reopen if you've identified the problem to be something on WinUI 3.

@gegao18 gegao18 closed this as completed Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NavigationView NavView control bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

4 participants