本文介绍了LostFocus事件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Winforms中,我能够验证文本框,如果无效,则可以通过类似的方式将焦点放回到控件上
In Winforms I was able to validate a textbox and if invalid put the focus back to the control by something like
private void textBox1_LostFocus(object sender, RoutedEventArgs e) { if (textBox1.Text == "") { textBox1.Focus(); textBox1.SelectAll(); } }推荐答案
FryingSaucer,
Hi FryingSaucer,
您实际上在做同样的事情. textBox1.Dispatcher.BeginInvoke仅用于对UI线程的跨线程调用.
You are practically doing the same thing. textBox1.Dispatcher.BeginInvoke is just for cross threading call to UI thread.
谢谢
穆罕默德
shujaatsiddiqi.blogspot
shujaatsiddiqi.blogspot
更多推荐
LostFocus事件的问题
发布评论