命令栏:未找到样式 'XamlDefaultCommandBar'
CommandBar: Style 'XamlDefaultCommandBar' not found
我没有在 Application.Current.Resources 中找到资源密钥 'XamlDefaultCommandBar' docs here。
但是,我找到了资源 'DefaultCommandBar'。对于非 UWP 平台上的 'Windows' 模式,这是否合适?
谢谢
你能提供更多关于你尝试过的细节吗? XamlDefaultCommandBar
resource 肯定存在于 Uno 中,并且至少从 Uno 2.0 开始就存在。您应该能够从 code-behind 使用以下方式访问它:
#if !NETFXCORE
var style = Application.Current.Resources["XamlDefaultCommandBar"] as Style;
#endif
或在Xaml中使用:
<CommandBar not_win:Style={StaticResource XamlDefaultCommandBar} />
(使用 not_win
prefix 因为 UWP 默认不提供它)。
无论如何,Uno都会默认为CommandBar
使用这种风格。如果您 overridden the global settings 让 Uno 在其他情况下使用原生样式,您应该只需要手动设置它。
我没有在 Application.Current.Resources 中找到资源密钥 'XamlDefaultCommandBar' docs here。
但是,我找到了资源 'DefaultCommandBar'。对于非 UWP 平台上的 'Windows' 模式,这是否合适?
谢谢
你能提供更多关于你尝试过的细节吗? XamlDefaultCommandBar
resource 肯定存在于 Uno 中,并且至少从 Uno 2.0 开始就存在。您应该能够从 code-behind 使用以下方式访问它:
#if !NETFXCORE
var style = Application.Current.Resources["XamlDefaultCommandBar"] as Style;
#endif
或在Xaml中使用:
<CommandBar not_win:Style={StaticResource XamlDefaultCommandBar} />
(使用 not_win
prefix 因为 UWP 默认不提供它)。
无论如何,Uno都会默认为CommandBar
使用这种风格。如果您 overridden the global settings 让 Uno 在其他情况下使用原生样式,您应该只需要手动设置它。