UWP CommandBar as resource

285 Views Asked by At

I got a CommandBar i'd like to use for all my pages within the app. When creating a new command bar using the 'New' button in the properties window and converting the new value to a resource using 'Convert to New Resource' (the resource is placed in a resource dictionary) VS creates the following xaml:

<Page.BottomAppBar>
    <StaticResource ResourceKey="BottomBar" />
</Page.BottomAppBar>

Resource dict.:

<CommandBar x:Key="BottomBar" />

Now when launching the application an unhandled exception with the message 'The parameter is incorrect' is thrown (inner exception: 'Value does not fall within the expected range'). Is that intended behaviour or is there a workaround (except for using a style)?

0

There are 0 best solutions below