TemplateStudio
TemplateStudio copied to clipboard
Complex NavigationViewItem brings to app crash.
Describe the bug
For default Items like this all is ok
<NavigationViewItem x:Uid="Shell_Main" helpers:NavigationHelper.NavigateTo="TestUnit.ViewModels.MainViewModel">
<NavigationViewItem.Icon>
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph=""/>
</NavigationViewItem.Icon>
</NavigationViewItem>
But in my case:
<NavigationViewItem
Width="80"
Height="70"
Padding="0"
helpers:NavigationHelper.NavigateTo="NAMH.ViewModels.MainViewModel">
<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="" />
</AnimatedIcon.FallbackIconSource>
</AnimatedIcon>
</NavigationViewItem.Content>
App will crash at startup with debugger break xaml unhendeled error.
Probably DefaultActivationHandler is navigating to early to the home page. I moved _navigationService.NavigateTo(typeof(MainViewModel).FullName!); to ShellPage OnLoaded and it works fine.
To Reproduce
Create default template generated project. Use NavItem as in example.
Additional context
No response
Applies to the following platforms:
- [X] WinUI
- [ ] WPF
- [ ] UWP
About your setup
- Visual Studio Version: Last
- Template Studio Wizard Version: Last
- Windows Build: Last