CommandBar: Style 'XamlDefaultCommandBar' not found

113 Views Asked by At

I did not find the resource key 'XamlDefaultCommandBar' as per docs here in Application.Current.Resources.

However, I found the resource 'DefaultCommandBar'. Would that be the right one for the 'Windows' mode on non-UWP platforms?

Thanks

1

There are 1 best solutions below

3
On BEST ANSWER

Can you provide more detail on what you tried? The XamlDefaultCommandBar resource is definitely present in Uno, and has been there since at least Uno 2.0. You should be able to access it from code-behind using:

#if !NETFXCORE
    var style = Application.Current.Resources["XamlDefaultCommandBar"] as Style;
#endif

or in Xaml using:

<CommandBar not_win:Style={StaticResource XamlDefaultCommandBar} />

(using the not_win prefix because it's not provided by default by UWP).

In any case, Uno will use this style by default for CommandBar. You should only need to manually set it if you've overridden the global settings to have Uno use native styles in other cases.