首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改CommandBar (AppBar)颜色

更改CommandBar (AppBar)颜色
EN

Stack Overflow用户
提问于 2016-07-11 10:10:55
回答 1查看 1.4K关注 0票数 1

我想更改CommandBar的BackgroundForeground的背景色。但是,简单地设置Background="whatever" Foreground="whatever"并不会更改溢出部分。

我尝试了几个小时,使用模板和样式等,但我真的不知道我在做什么,所以这是无用的。我读过https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/styling-controlshttps://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/control-templates (以及这个站点上的许多问题),它们确实告诉您,有一件事就是改变样式,它们向您展示了如何将元素设置为特定的样式。但它们不能告诉你哪些元素有可用的变量..。此外,当右键单击CommandBar -编辑风格-编辑一个副本-我得到的是一个空的,这会立即使CommandBar不可见。这对我来说毫无意义。

那么-如何更改CommandBar的样式/模板?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-11 10:48:05

这篇博客文章详细介绍了如何解决溢出问题:

https://metronuggets.com/2015/08/04/universal-windows-apps-appbars-and-custom-colours/

它涉及到为溢出情况指定样式。

主要的魔法就在这里:

代码语言:javascript
复制
<Page.BottomAppBar>
    <CommandBar Background="Blue"
                Foreground="White">
        <CommandBar.CommandBarOverflowPresenterStyle>
            <Style TargetType="CommandBarOverflowPresenter">
                <Setter Property="Background"
                        Value="Blue" />
            </Style>
        </CommandBar.CommandBarOverflowPresenterStyle>
        <CommandBar.PrimaryCommands>
            <AppBarButton Label="settings"
                          Icon="Setting"
                          Foreground="White"/>
        </CommandBar.PrimaryCommands>
        <CommandBar.SecondaryCommands>
            <AppBarButton Label="about"
                          Foreground="White"/>
        </CommandBar.SecondaryCommands>
    </CommandBar>
</Page.BottomAppBar>
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38304315

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档