将 TextBlock.Text 设置为包含的字符串
我正在从数据库中读取一个字符串,并将其绑定到 XAML(Silverlight 应用程序)中的 TextBlock 控件。来自数据库的字符串已包含字符串中的元素。示例字符串如下:Microsoft's TechEd 会议是向 IT 专业人员和开发人员介绍当前发布的和近期的 Microsoft 技术的最大年度会议。
当字符串呈现时,它显示为文本而不是换行符(空格)。如何让 TextBlock 控件(或任何其他控件)根据渲染文本时显示空格?
I have a string that I am reading from the database and binding it to a TextBlock control in a XAML (Silverlight app). The string that's coming from the database already has elements in the string. A sample string is this: Microsoft's TechEd conference is the largest annual conference for introducing IT professionals and developers to currently shipping and near-term Microsoft technologies.<linebreak><linebreak>Designed for those who build, deploy or operate solutions based on Microsoft technologies.
When the string is rendered the appear as text and not as line breaks (spaces). How can I get the TextBlock control (or any other control) to display the spaces based on when rendering the text?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在将字符串绑定到 TextBlock 之前,为什么不进行正则表达式匹配并替换字符串呢?
或类似的东西
Why don't you do a Regex match and replace on the string before binding it to the TextBlock.
or something to that effect