如何在 C# 中为 Windows Phone 设置 TextBlock 的前景 属性

How to set the foreground property of a TextBlock in C# for Windows Phone

出于某种原因,我在设置 TextBlock 的前景时遇到问题。

我试过:

我正在开发 Windows Phone 8.1 应用程序。

它必须是颜色 class(但不是颜色)。示例:

var textblocks = new TextBlock() { Height = box_height, Width = box_width, Text = "Hello", FontSize = 30, Foreground = new SolidColorBrush(Colors.Black) };