gpt4 book ai didi

silverlight - 如何在 Silverlight 中使 TextBlock 的文本加粗?

转载 作者:行者123 更新时间:2023-12-04 01:00:49 26 4
gpt4 key购买 nike

我正在用 C# 开发 window phone 7 应用程序。我是 window phone 7 应用程序的新手。我也是银光的新手。我想动态生成 Texblock 的粗体文本。我只想为文本的某些部分生成粗体文本。我正在使用以下代码

IncometextBlock.Text = "Income entries on " + selectedDate.ToShortDateString() + "        Page - "+SelectedButtonName+"";

我希望输出为

" 收入条目 21/01/2011 页 - A "

我想要上面的输出。如何制作上述要求的粗体文字?您能否提供我可以解决上述问题的任何代码或链接。如果我做错了什么,请指导我。

最佳答案

我会这样做。

IncometextBlock.Inlines.Clear();
IncometextBlock.Inlines.Add(new Run() {Text = "Income entries", FontWeight = FontWeights.Bold});
IncometextBlock.Inlines.Add(new Run() {Text = " on " });
IncometextBlock.Inlines.Add(new Run() {Text = selectedDate.ToShortDateString(), FontWeight = FontWeights.Bold});
IncometextBlock.Inlines.Add(new Run() {Text = " Page - "});
IncometextBlock.Inlines.Add(new Run() {Text = SelectedButtonName, FontWeight = FontWeights.Bold});

关于silverlight - 如何在 Silverlight 中使 TextBlock 的文本加粗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5064205/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com