我现在有以下XAML:检查多行文本框是否为空?
<TextBox Text="" x:Name="textFeedbackFeedback"
Margin="11.593,0,29.307,42.96" TextWrapping="Wrap"
VerticalContentAlignment="Top" VerticalAlignment="Bottom"
Height="92.08" AcceptsReturn="True" VerticalScrollBarVisibility="Visible"/>
我已经使用了很多的变化的尝试:
if(textFeedbackFeedback.text == "")
if(textFeedbackFeedback.text == null)
if(textFeedbackFeedback.text == string.Empty)
if(string.IsNullOrEmpty(textFeedbackFeedback.Text))
但由于某些原因,它不会停在那里,并继续仿佛有数据在那里,有人可以帮我在这里。
谢谢。
你确定它是空的吗?那里没有回车?那如何String.IsNullOrWhiteSpace(textBox.Text)? –
请勿在标题中加入“WPF C#”之类的内容。这就是标签的用途。 –
当您在调试器中查看textFeedbackFeedback.Text时,它显示了什么? – itowlson