Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GotFocus event of TextBox in Caliburn Micro?

I am using Calibrun Micro and WPF, I have a textBox and when i recieves a focus I want to call a method in ViewModel and same when it leaves LostFocus.

like image 611
Kishore Kumar Avatar asked Dec 12 '22 21:12

Kishore Kumar


1 Answers

You can use the Message.Attach syntax to hook on the GotFocus and LostFocus event

The following code will call the GotFocusMethod and LostFocusMethod on your viewmodel:

<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.

like image 102
nemesv Avatar answered Dec 27 '22 19:12

nemesv