Hi,
In my application, I haev menu items. one of the menu item name is CLOSE. I also have a textbox in my UI. I want to do soem validation on my textbox on lost focus. I am able to do this but I am not able to handle one case. Scenario is like this: When user type value in textbox and then quickly clicks on CLOSE menu item, in that case I don't want my textbox validation to fire.
How to achieve this ?
Loading
Shweta LodhaPosted Mar 16, 2014, 3:54 PM
1) By checking the tab indexes
2) Lost keyboard focus - On LostKeyboardFocus of the TextBox check if the value of property KeyboardFocusChangedEventArgs.NewFocus is equal to CLOSE.
void TextBox_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
if (e.NewFocus == CLOSE)
{
//do not validate
}
//validate textbox value
}
RukhsaanPosted Mar 16, 2014, 4:17 PM