我現在有以下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