LostFocus事件的问题 [英] Problems with LostFocus event
本文介绍了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.com
shujaatsiddiqi.blogspot.com
这篇关于LostFocus事件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文