如何在Silverlight中将TextBlock的文本设置为粗体?
我正在用 C# 开发 Windows Phone 7 应用程序。我是 Windows Phone 7 应用程序的新手。我也是银光新手。我想动态生成Texblock的粗体文本。我只想为文本的某些部分生成粗体文本。我正在使用以下代码,
IncometextBlock.Text = "Income entries on " + selectedDate.ToShortDateString() + " Page - "+SelectedButtonName+"";
我希望输出为
“21/01/2011 页面上的收入条目 - A”
我想要上述输出。如何将上述要求的文字加粗?您能否提供任何代码或链接来解决上述问题。如果我做错了什么,请指导我。
I am developing window phone 7 application in C#. I am new to the window phone 7 application. I am also new to the silverlight. I want to generate the bold text of Texblock dynamically. I want to generate the bold text only for some part of the text. I am using the following code
IncometextBlock.Text = "Income entries on " + selectedDate.ToShortDateString() + " Page - "+SelectedButtonName+"";
I want the output as
"Income entries on 21/01/2011 Page - A"
I want the above output. How to make the bold text for above requirement ? Can you please provide me any code or link through which I can resolve the above issue. If I am doing anything wrong then please guide me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会这样做。
I'd do it like this.
如果您使用 WrapPanel(来自工具包),您可以执行以下操作:(
以上是仅在网格中启用代码突出显示,并且不需要使效果起作用。)
If you use the WrapPanel (from the Toolkit) you can do this:
(The above is only in a grid to enable code highlighting here in SO and does not need to be for the effect to work.)