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

WinUI:NavigationView does not navigate in Release Mode #2774

Closed
Pinox opened this issue Nov 27, 2018 · 14 comments
Closed

WinUI:NavigationView does not navigate in Release Mode #2774

Pinox opened this issue Nov 27, 2018 · 14 comments
Assignees
Labels
bug The issue relates to the wizard not working or a problem with the generated code.
Milestone

Comments

@Pinox
Copy link

Pinox commented Nov 27, 2018

Hi , something I noticed , the Hamburger menu items does not change the page views when app is build to UWP Release Mode.

releasemode1

Using latest stable VS 15.9.2
ts

@crutkas
Copy link
Member

crutkas commented Nov 27, 2018

@Pinox can you share the 'recipe' you used to aid us in debugging?

@Pinox
Copy link
Author

Pinox commented Nov 27, 2018

@crutkas Sure, Navigation Menu , Mvvmlight and then I had a couple of random pages as in screenshot above.

@sibille
Copy link
Collaborator

sibille commented Nov 28, 2018

@Pinox, we're having a look at this.
The issue seems to be related to using the EventTriggerBehavior on the ItemInvoked event.

While we are working on a fix you can workaround by using the event instead.
In ShellPage.xaml, remove the following code:

<ic:EventTriggerBehavior EventName="ItemInvoked">
         <ic:InvokeCommandAction Command="{x:Bind ViewModel.ItemInvokedCommand}" />
 </ic:EventTriggerBehavior>

and add

ItemInvoked="NavigationView_ItemInvoked"

In the ShellPage.xaml.cs add:

private void NavigationView_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args)
{
     ViewModel.ItemInvokedCommand.Execute(args);
}

@sibille sibille added the bug The issue relates to the wizard not working or a problem with the generated code. label Nov 28, 2018
@sibille sibille changed the title Hamburger menu - Release Mode WinUI:NavigationView does not navigate in Release Mode Nov 28, 2018
@sibille sibille added the in-progress The issue is currently being actively worked on. label Nov 28, 2018
@Pinox
Copy link
Author

Pinox commented Nov 28, 2018

@sibille Thanks.

@crutkas
Copy link
Member

crutkas commented Nov 28, 2018

Will this need a hot fix?

@sibille
Copy link
Collaborator

sibille commented Nov 29, 2018

Created an issue to investigate this at microsoft/XamlBehaviors#142. I think we should prepare a hotfix with the workaround while investigating the root cause.

mvegaca added a commit to mvegaca/WindowsTemplateStudio that referenced this issue Nov 29, 2018
@mvegaca
Copy link
Collaborator

mvegaca commented Nov 29, 2018

Hotfix added on a pull request
#2776

@mvegaca mvegaca removed the in-progress The issue is currently being actively worked on. label Nov 29, 2018
@mvegaca mvegaca removed their assignment Nov 29, 2018
sibille added a commit that referenced this issue Nov 29, 2018
@sibille
Copy link
Collaborator

sibille commented Nov 30, 2018

Hotfix published

@pedrolamas
Copy link

I see that you've moved away from the XAML Behaviors with this hotfix, but in case you still want to use it, I have a solution for you!

On the "Default.rd.xml" template files, add the following directives:

<Type Name="Windows.Foundation.TypedEventHandler{Microsoft.UI.Xaml.Controls.NavigationView,Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs}" MarshalObject="Public" />

<Type Name="Microsoft.UI.Xaml.Controls.NavigationView">
  <Event Name="ItemInvoked" Dynamic="Required"/>
</Type>

This will be enough to ensure that NavigationView.ItemInvoked event can be used dynamically with reflection (in this case, with the EventTriggerBehavior)

@crutkas
Copy link
Member

crutkas commented Dec 6, 2018

Oooo. Thanks Pedro. Sibille, thoughts?

@sibille
Copy link
Collaborator

sibille commented Dec 7, 2018

I think we should re-include the behaviour and the directives in the Default.rd.xml file, adding a comment that explains what they are needed for.

@sibille sibille removed the external-issue Used to indicate the issue is not directly in WTS but a third-party. label Dec 7, 2018
@sibille sibille added this to the 3.0 milestone Dec 17, 2018
This was referenced Dec 18, 2018
@sibille sibille added the Can Close Out Soon Work relating to this issue has been completed. label Dec 21, 2018
@dgomezc dgomezc removed the Can Close Out Soon Work relating to this issue has been completed. label Jan 9, 2019
@dgomezc
Copy link
Collaborator

dgomezc commented Jan 9, 2019

Verified in dev-nightly:
Templates version: 0.20.19009.3
Wizard version: 0.20.19009.1

@paulober
Copy link

Does somebody know where to mention this issue that it gets fixed by default (also for people who don't use WTS)? Maybe at the Microsoft.Xaml.Interactivity team or the microsoft-ui-xaml repo or the UWP Team?

@mrlacey
Copy link
Collaborator

mrlacey commented Aug 22, 2021

Does somebody know where to mention this issue that it gets fixed by default (also for people who don't use WTS)? Maybe at the Microsoft.Xaml.Interactivity team or the microsoft-ui-xaml repo or the UWP Team?

@PavLL Yes, a fix for this at a UWP level should be reported at the WinUI repository. (Maybe reopen your issue there as a workaround isn't as good as a fix.)
Or, for WinUI related issues, report them on the WindowsAppsSDK repo as that's where the templates for WinUI 3 projects live.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug The issue relates to the wizard not working or a problem with the generated code.
Projects
None yet
Development

No branches or pull requests

8 participants