【问题标题】:Background color in UWP AppUWP 应用中的背景颜色
【发布时间】:2018-02-09 10:23:53
【问题描述】:

我们最近从 windows 框架从 10.0.10240 升级到 10.0.15063。我们遇到了button 设计问题,其中background color 显示为灰色。在升级之前没有出现这种颜色。我们需要去除文本后面的灰色。

在图像悬停时也会出现相同的前景色:

Xamarin.Forms.Button 没有前景色等效属性。我尝试了设置Xamarin.Forms.Platform.UWP.FormsButton.Foreground 的自定义渲染器,但对按钮控制没有影响。

是否有任何样式设置器可以尝试解决此问题?请帮忙。

编辑

这是通过应用背景颜色解决的,之前我在按钮上设置了前景,

this.Control.BackgroundColor = new SolidColorBrush() { Opacity = 1, Color= Windows.UI.Colors.Transparent };

【问题讨论】:

  • 如果你指的是灰色矩形,那不是前景,那是按钮的背景属性,前景属性通常归因于文本的颜色,并且有单独的悬停颜色可用选择和修改。
  • 我无法重现您的问题。您的 uwp 客户端项目中是否有自定义按钮 ContentTemplate 或按钮 Style
  • 感谢您的帮助。@Digitalsa1nt 它的 BackgroundColor 属性,并手动将其设置为透明它有效。 @NicoZhu-MSFT 我在msdn.microsoft.com/en-in/library/windows/apps/mt299109.aspx 的按钮上使用自定义样式属性,但在最近的版本中出现了问题。现在手动设置this.Control.BackgroundColor = new SolidColorBrush() { Opacity = 1, Color= Windows.UI.Colors.Transparent }; 效果很好。
  • 是的,没问题。

标签: xamarin uwp xamarin.forms uwp-xaml xamarin.uwp


【解决方案1】:

通过应用背景颜色解决了这个问题。

this.Control.BackgroundColor = new SolidColorBrush(){Opacity = 1,Color = Windows.UI.Colors.Transparent };

【讨论】:

    猜你喜欢
    • 2018-03-20
    • 2016-07-04
    • 1970-01-01
    • 2019-03-12
    • 1970-01-01
    • 2021-05-28
    • 1970-01-01
    • 2019-12-22
    • 2020-08-28
    相关资源
    最近更新 更多