TextBox中的换行符 [英] Linebreak in TextBox

查看:142
本文介绍了TextBox中的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定这是否是LightSwitch问题,但我的实体中有一个字符串字段包含换行符(\\\\ n)。但是这些换行符在绑定到TextBox时会被过滤掉。即使我在代码中将TextBox.Text属性设置为例如"line1 \\\\ line2",
删除了换行符。(我通过使用this.FindControl()搜索TextBox并将一个Action分配给ControlAvailable事件。)

Not sure if this is a LightSwitch problem, but I have a string field in my entity contain linebreaks (\r\n). But these linebreaks are filtered out when it is binded to a TextBox. Even when I set the TextBox.Text property in code to e.g. "line1\r\nline2", the linebreak is removed. (I searched for the TextBox by using this.FindControl() and assign an Action to the ControlAvailable event).

在常规的Silverlight应用程序中,这可以正常工作。

In regular Silverlight application this works fine.

任何人都知道问题是什么?

Anybody any idea what the problem can be?

推荐答案

你能澄清你所做的事情吗?"删除了换行符"还是稍微描述一下?

Can you clarify what you meaned by "the linebreak is removed" or describe it a little more?

我试图重现你所看到的,却无法重现。我得到的结果是"line1"。和"line2"在单独的行上但是文本框不够高,无法同时完全显示。如果这是您的问题,您可以将
属性表中TextBox上的Lines属性设置为大于1的值,以显示所有文本行。

I've tried to reproduce what you are seeing, but was unable to. The result that I have is that "line1" and "line2" are on separate lines BUT the textbox is not tall enough to display both completely at the same time. If this is your problem, you can set the Lines property on the TextBox in the property sheet to something greater than one to show all of the lines of text.


这篇关于TextBox中的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆