如何在 Silverlight RichTextBox 中设置格式化文本?
如何使 RichTextBox
显示具有格式的字符串?
我正在使用 Run
但它不起作用:
// create a paragraph
Paragraph prgParagraph = new Paragraph();
prgParagraph.FontFamily = new FontFamily("Comic Sans MS");
// create some text, and add it to the paragraph
Run rnMyText = new Run();
rnMyText.Text = w.meaning;
prgParagraph.Inlines.Add(rnMyText);
rtxtMeaning.Blocks.Add(prgParagraph);
How can I make a RichTextBox
show a string with format?
I'm using Run
but it dosen't work:
// create a paragraph
Paragraph prgParagraph = new Paragraph();
prgParagraph.FontFamily = new FontFamily("Comic Sans MS");
// create some text, and add it to the paragraph
Run rnMyText = new Run();
rnMyText.Text = w.meaning;
prgParagraph.Inlines.Add(rnMyText);
rtxtMeaning.Blocks.Add(prgParagraph);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道这个问题已经有几年了,但我也有同样的问题,这就是我想到的。我已经用我的 Silverlight 5 项目对其进行了几次测试,它对我有用。
确保当您调用该方法时,您对 RichTextBox 对象使用 ref 关键字,然后就可以开始了 =)
I know that this question is a couple years old, but I had the same question and here's what I came up with. I've tested it a few times with my Silverlight 5 project and it works for me.
make sure that when you call the method you use the ref keyword for your RichTextBox object and you're good to go =)