【问题标题】:Problem rendering Custom "MenuItem"呈现自定义“菜单项”时出现问题
【发布时间】:2011-02-09 14:49:00
【问题描述】:

这是我的问题:

当我在我的计算机中打开我的程序时,选项菜单呈现如下: http://img811.imageshack.us/img811/1623/prob1.jpg

但是当我用我的 父亲 的计算机和我的 兄弟 计算机打开我的程序时,MenuItem 呈现如下: http://img203.imageshack.us/img203/3451/prob2l.jpg

正如您在我的计算机中看到的那样,它将文本呈现为黑色,而在其他计算机中将文本呈现为白色。

这是我的代码:

<Separator>
    <Separator.Template>
        <ControlTemplate>
            <Border CornerRadius="2" Padding="5" Background="PaleGoldenrod" BorderBrush="Black" BorderThickness="1">
                <TextBlock Text="Global Options (Are Saved):" FontWeight="Bold" />
            </Border>
        </ControlTemplate>
    </Separator.Template>
</Separator>

【问题讨论】:

  • 没有必要在您的标题中添加“[C# / WPF]”。我们有标签。

标签: c# wpf render menuitem


【解决方案1】:

您是否尝试将 texblock 前景设置为黑色? (也许 Vista / 7 默认为黑色,而 XP 没有,强制它为黑色可能会有所帮助)

<TextBlock Text="Global Options (Are Saved):" FontWeight="Bold" Foreground="Black" />

【讨论】:

  • 哦,它成功了。感谢您提供简单的解决方案。我怎么没想到? :(
  • 很高兴它有帮助,它发生了!当我看自己的代码太久时,我总是失明! ;)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-05-24
  • 2021-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多