【问题标题】:Where has TextBlock Background property gone in UWP?UWP 中的 TextBlock Background 属性去了哪里?
【发布时间】:2016-03-11 22:52:26
【问题描述】:

我需要在 UWP 中更改 TextBlock 的背景,但背景属性不再存在。解决办法是什么?

这行不通...

                    <TextBlock Text="Exceptions Log"
                               FontSize="10"
                               Background="Red" // This is invalid
                               />

谢谢

【问题讨论】:

    标签: xaml uwp


    【解决方案1】:

    只需将它放在网格或边框或其他东西中......

    <Border Background="Red">
        <TextBlock Text="Exceptions Log"
                   FontSize="10" />
    </Border>
    

    【讨论】:

    • 谢谢 igrali。我确实想过将它包装在 Border 中,但也想知道我是否做错了什么,因为 Background 确实作为 WPF 中 TextBloxk 上的属性存在。感谢您的快速响应。
    猜你喜欢
    • 2020-10-25
    • 1970-01-01
    • 2020-06-08
    • 1970-01-01
    • 2016-01-29
    • 2016-12-07
    • 1970-01-01
    • 2014-02-02
    • 2011-11-03
    相关资源
    最近更新 更多