Hello,
I have created a new control that inherits RadAutoCompleteBox and I need to make some work when the control lost its focus.
I have written a OnLostFocus method that overrrides the base method, but it is unfortunately never called.
Is this a bug?
Patrick
3 Answers, 1 is accepted
0
Accepted
Kalin
Telerik team
answered on 09 May 2014, 12:20 PM
Hello Patrick,
You should either override OnLostKeyboardFocus method or subscribe to the LostFocus event the following way in the constructor:
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
But it seems that there is a bug in the control code: by .NET patterns, the OnLostFocus methos MUST be called to raise the LostFocus event. So overriding the OnXXX method on an inherited class is the same as attaching to the XXX event.
Patrick
0
Kalin
Telerik team
answered on 13 May 2014, 11:06 AM
Hi Patrick,
This is so in the particular scenario because of the WatermarkTextBox used inside of the AutoCompleteTextBox ControlTemplate. When you focus the AutoCompleteBox, the WatermarkTextBox element inside actually gets the focus and afterwards when the focus is lost the OnLostFocus method of the WatermarkTextBox is triggered.
Hope this helps.
Regards,
Kalin
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.