[英]GotFocus event of TextBox in Caliburn Micro?
我正在使用Calibrun Micro和WPF,我有一个textBox,当我收到焦点时,我想在ViewModel中调用一个方法,当它离开LostFocus时也是如此。
You can use the Message.Attach syntax to hook on the GotFocus
and LostFocus
event 您可以使用Message.Attach语法挂钩
GotFocus
和LostFocus
事件
The following code will call the GotFocusMethod
and LostFocusMethod
on your viewmodel: 以下代码将在您的viewmodel上调用
GotFocusMethod
和LostFocusMethod
:
<TextBox cal:Message.Attach="[Event GotFocus] = [Action GotFocusMethod];
[Event LostFocus] = [Action LostFocusMethod]" />
Note: don't forget the separating the actions with a semicolon ;
注意:不要忘记用分号分隔动作
;
when you declare multiple actions. 当您声明多个动作时。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.