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

MUX: NavigationView Does Not Select first NavigationViewItem #4794

Closed
2 of 24 tasks
robloo opened this issue Dec 23, 2020 · 4 comments · Fixed by #4811
Closed
2 of 24 tasks

MUX: NavigationView Does Not Select first NavigationViewItem #4794

robloo opened this issue Dec 23, 2020 · 4 comments · Fixed by #4811
Assignees
Labels
kind/bug Something isn't working project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...)
Milestone

Comments

@robloo
Copy link
Contributor

robloo commented Dec 23, 2020

Current behavior

Using the new MUX NavigationView in Uno 3.4, after the NavigationView loads for the first time, the selection indicator is not visible. The selected NavigationViewItem content is correctly shown -- only the indicator isn't visible.

image

I would guess this has something to do with animations.

Expected behavior

The selection indicator should appear.

image

How to reproduce it (as minimally and precisely as possible)

As described above.

Workaround

Not tested, probably setting the selection a second time? Although in manual testing it appears a different NavigationViewItem must be selected and navigated to before selection will be valid.

Environment

Nuget Package:

  • Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

Nuget Package Version(s): 3.4.0

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

IDE:

  • Visual Studio 2017 (version: )
  • Visual Studio 2019 (version: )
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

@robloo robloo added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Dec 23, 2020
@MartinZikmund
Copy link
Member

My guess it is due to the fact that due to different lifecycle of controls the NavigationView items we needed a workaround in which items are initialized late. And that may in turn cause the selection to be omitted. I will look into that

@MartinZikmund MartinZikmund added project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) and removed triage/untriaged Indicates an issue requires triaging or verification labels Dec 24, 2020
@MartinZikmund MartinZikmund self-assigned this Dec 24, 2020
@MartinZikmund MartinZikmund added this to the 3.5 milestone Dec 24, 2020
@robloo
Copy link
Contributor Author

robloo commented Dec 29, 2020

Hm, sounds like it might be tricky then. Regardless,, thanks a lot for taking the time to upgrade NavigationView. Its very nice to finally be able to share the same control with UWP.

@MartinZikmund
Copy link
Member

MartinZikmund commented Dec 29, 2020

@robloo thanks! Yes, it is a quite a bit trickier, especially as the control lifecycle differs between different targets (in this case it is all about when OnApplyTemplate and Loaded events are called for NavigationView, NavigationItem and NavigationItemPresenter), so it is tricky to get it just right to work on all of them but I think I am getting there slowly 😀

MartinZikmund added a commit to MartinZikmund/Uno that referenced this issue Dec 30, 2020
- Fixes unoplatform#4794 - ensures the pre-selected NavigationView item is indicated after loading
@mergify mergify bot closed this as completed in #4811 Jan 7, 2021
@navio-n
Copy link

navio-n commented Jun 14, 2021

I am having problems with first-time selection on both UWP and Android when using MVVM, data binding, and MenuItemTemplates:

...
MenuItemsSource="{x:Bind ViewModel.NavigationItems}"
SelectedItem="{x:Bind ViewModel.SelectedNavigationItem, Mode=TwoWay}">
...

        <muxc:NavigationView.MenuItemTemplate>
            <DataTemplate x:DataType="vm:MenuItem">
                <muxc:NavigationViewItem Content="{x:Bind Title}">
                    <muxc:NavigationViewItem.Icon>
                        <SymbolIcon Symbol="{x:Bind Symbol}" />
                    </muxc:NavigationViewItem.Icon>
                </muxc:NavigationViewItem>
            </DataTemplate>
        </muxc:NavigationView.MenuItemTemplate>

It doesn't work when programmatically going through pages also. Works only when clicking on the menu items. I found multiple issues about this so I am not sure where to post the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants