Saturday, August 1, 2020

UWP NavigationView Cannot find a Resource with the Name/Key TabViewButtonBackground

Cannot find a Resource with the Name/Key TabViewButtonBackground NavigationView;Cannot find a Resource with the Name/Key TabViewButtonBackground;An exception of type 'Windows.UI.Xaml.Markup.XamlParseException'


After recent updates, UWP Application fails at InitializeComponent() within page using Microsoft.UI.Xaml.Controls.NavigationView


Error:
Cannot find a Resource with the Name/Key TabViewButtonBackground NavigationView
An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in MySampleApp.exe but was not handled in user code



Fix :    

You will need to add XamlControlsResources to your app.xaml file

<Application>
    <Application.Resources>
        <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
    </Application.Resources>
</Application>

Happy coding!