Reputation: 89
Lost Focus Event Code:
public void myTextBox_LostFocus(object sender, System.Windows.Input.GestureEventArgs e)
{
string name = ((TextBox)sender).Name;
string strl = "tbox" + name.Substring(4);
TextBox text = FindTextBoxByName(strl);
text.HorizontalAlignment = HorizontalAlignment.Left;
text.Width = 50;
text.Height = 40;
}
Event Call:-
myTextBox1j.LostFocus += new EventHandler<GestureEventArgs>(myTextBox_LostFocus);
Throws Following Error:- Cannot implicitly convert type'System.EventHandler' to 'System.Windows.RoutedEventHandler'
Upvotes: 0
Views: 407
Reputation: 66439
The LostFocus
event expects a RoutedEventHandler
, not EventHandler
.
myTextBox1j.LostFocus += new RoutedEventHandler(myTextBox_LostFocus);
This should work too:
myTextBox1j.LostFocus += myTextBox_LostFocus;
Upvotes: 2