Kevin McNeish Blog

All things iOS, Kindle and .NET

Recent Posts

Tags

News

  • First books in my new book series, "iOS App Development for Non-Programmers" are now available! iBookStore: http://itunes.apple.com/us/book/book-1-diving-in-ios-app-development/id558788074?mt=11 Amazon: http://www.amazon.com/dp/B0097N8XBE Amazon: http://www.amazon.com/dp/B0099RQGMQ

Community

Email Notifications

Archives

Fixing WPF TextBox Mouse Events Not Firing

If you create a handler for the WPF TextBox's mouse events, you will find that the code in your handler never fires. This is because the event is marked as "handled" in the .NET Framework, so it never reaches your code.

To get around this bad behavior, you can use the TextBox's AddHandler() method to register your handler method, passing a true for the handledEventsToo parameter. For example:

this.txtCustomerID.AddHandler(ControlMouseLeftButtonUpEvent, 
    new MouseButtonEventHandler(txtCustomerID_MouseLeftButtonUp), true);

Best Regards,

Kevin McNeish
INETA Speaker
Chief Architect, MM .NET Application Framework
http://www.oaleafsd.com

 

Leave a Comment

(required) 

(required) 

(optional)
 

(required) 

If you can't read this number refresh your screen
Enter the numbers above: