You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4. The application has a TextBox control named txtName. You need to handle the event when txtName has the focus and the user presses the F2 key. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A.
txtName.KeyDown += new KeyEventHandler(txtName_KeyDown);
B.
txtName.LostFocus += new RoutedEventHandler(txtName_LostFocus);
C.
txtName.TextChanged += new TextChangedEventHandler(txtName_TextChanged);
D.
void txtName_TextChanged(object sender, TextChangedEventArgs e)
{
if ((Key)e.OriginalSource == Key.F2)
{
//Custom logic
}
}
E.
void txtName_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.F2)
{
//Custom logic
}
}
F.
void txtName_LostFocus(object sender, RoutedEventArgs e)
{
if ((Key)e.OriginalSource == Key.F2)
{
//Custom logic
}