【发布时间】:2018-03-14 15:26:09
【问题描述】:
当我调整 UWP 应用程序的窗口大小时,我需要更改显示在右侧的默认白色背景,并且我需要动态地进行。
我试过了:
var newBackground = Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as SolidColorBrush;
if (newBackground != null)
{
newBackground.Color = newColor;
}
newBackground 已更改,但不影响应用程序。
有什么帮助吗?
【问题讨论】:
-
您的代码中的
background是什么? -
搞错了,我已经更新了我的问题。
-
你想覆盖
ApplicationPageBackgroundThemeBrush吗? -
我想更改 App 的默认背景颜色。如果您设置浅色主题,则颜色为白色,如果您设置深色主题,则颜色为黑色。我在 App 的主根后面。
-
但是
ApplicationPageBackgroundThemeBrush具有与您想要的相同的行为。检查here
标签: c# colors background uwp resize