【问题标题】:UWP: styling the window buttons does not work on the close buttonUWP:设置窗口按钮的样式在关闭按钮上不起作用
【发布时间】:2015-07-26 11:23:33
【问题描述】:

在 Windows 10 UWP 中,我们可以设置标题栏和窗口按钮(windows chrome)的样式。 但是,当使用悬停或单击关闭按钮时,这不适用于关闭按钮。 取下面的sn-p:

        Color PrimaryColor = Color.FromArgb( 0xFF, 0xFF, 0x00, 0x00 );
        Color ContrastColor = Color.FromArgb( 0xFF, 0x00, 0x00, 0x00 );
        Color SemiColor = Color.FromArgb( 0xFF, 0x7F, 0x00, 0x00 );

        ApplicationView AppView = ApplicationView.GetForCurrentView();

        AppView.TitleBar.ButtonInactiveBackgroundColor = ContrastColor;
        AppView.TitleBar.ButtonInactiveForegroundColor = PrimaryColor;
        AppView.TitleBar.ButtonBackgroundColor = ContrastColor;
        AppView.TitleBar.ButtonForegroundColor = PrimaryColor;

        AppView.TitleBar.ButtonHoverBackgroundColor = PrimaryColor;
        AppView.TitleBar.ButtonHoverForegroundColor = ContrastColor;

        AppView.TitleBar.ButtonPressedBackgroundColor = SemiColor;
        AppView.TitleBar.ButtonPressedForegroundColor = ContrastColor;

这应该使所有按钮变黑并带有红色前景(图标)。按下时应使用半红色背景。
它完美地适用于最小和最大按钮 - 在关闭按钮上,只有背景和前景(以及它的非活动版本)正确显示。悬停和按下状态回退到默认窗口值。

参考下图。关闭按钮有另一个红色(默认)和悬停时默认的白色前景。

_

有人知道问题出在哪里吗?是错误还是我做错了什么?

提前致谢!
-西蒙

【问题讨论】:

  • 您找到解决方案了吗?如果你这样做会很高兴......
  • 我从来不知道如何解决它——抱歉

标签: c# .net win-universal-app


【解决方案1】:

你做得对,现在就是这样。请记住,他们仍在根据用户反馈更改标题栏样式,因此这可能会发生变化。如果您想对标题栏的某些方面进行更多控制,请考虑使用 CoreApplicationViewTitleBar.ExtendViewIntoTitleBar 属性构建完全自定义的标题栏。不过,不确定它是否能解决这个特定问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-10-30
    • 2012-05-14
    • 2018-07-06
    • 2021-04-04
    • 2017-07-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多