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

OpacityTransition Causes app crash #9190

Open
Petrarca181 opened this issue Dec 27, 2023 · 0 comments
Open

OpacityTransition Causes app crash #9190

Petrarca181 opened this issue Dec 27, 2023 · 0 comments
Labels
area-NavigationView NavView control bug Something isn't working team-Controls Issue for the Controls team

Comments

@Petrarca181
Copy link

Petrarca181 commented Dec 27, 2023

Describe the bug

If I add OpacityTransition to NavigationView and try to navigate my app crashes

<NavigationView.OpacityTransition>
         <ScalarTransition />
</NavigationView.OpacityTransition>

Exception:

Access is denied.

Access denied.  Calling ElementCompositionPreview.GetElementVisual API is not allowed on this object at this time, as this object currently has the OpacityTransition property in use.
This is one of mine Navigation Items
  <NavigationViewItem
     Width="70"
      Height="65"
      Margin="0,3,0,0"
      Padding="0"
      helpers:MyNavigationHelper.NavigateTo="NAMHV5.ViewModels.HomeViewModel"
      AnimatedIcon.State="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected, Mode=OneWay, Converter={StaticResource StateConverter}}">
      <NavigationViewItem.Content>
          <AnimatedIcon
              Width="50"
              Height="50"
              Margin="0,0,7,0"
              HorizontalAlignment="Center"
              VerticalAlignment="Center">
              <AnimatedIcon.Source>
                  <animatedVisuals:Home />
              </AnimatedIcon.Source>
              <AnimatedIcon.FallbackIconSource>
                  <FontIconSource
                      FontFamily="Segoe MDL2 Assets"
                      FontSize="25"
                      FontWeight="Bold"
                      Glyph="&#xE713;" />
              </AnimatedIcon.FallbackIconSource>
          </AnimatedIcon>
      </NavigationViewItem.Content>
  </NavigationViewItem>

As a quick fix I just put NavView inside a border and apply opacity transitions and animations to it, works fine.

Steps to reproduce the bug

I'm using template studio.
So create a new app with navigation view and add some pages.
Go to shell page and add

<NavigationView.OpacityTransition>
         <ScalarTransition />
</NavigationView.OpacityTransition>

to the NavigationView
Launch the app and and navigate to any page.

Expected behavior

not crash

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.4.3: 1.4.231115000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@Petrarca181 Petrarca181 added the bug Something isn't working label Dec 27, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 27, 2023
@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 18, 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

2 participants