Exam1pass
Easiest way to pass IT exams
Exam1pass Help You Pass Any IT Exam
http://www.exam1pass.com
Exam
: Microsoft 70-502(C#)
Title
: TS: Microsoft .NET
Framework 3.5 –Windows
Presentation Foundation
Version : Demo
Exam1pass
Easiest way to pass IT exams
Exam1pass Help You Pass Any IT Exam
http://www.exam1pass.com
1. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework
3.5.
You add a CommandBinding element to the Window element. The command has a keyboard gesture
CTRL+H. The Window contains the following MenuItem control.
<MenuItem Header="Highlight Content" Command="local:CustomCommands.Highlight" />
You need to ensure that the MenuItem control is disabled and the command is not executable when the
focus shifts to a TextBox control that does not contain any text.
What should you do?
A. Set the IsEnabled property for the MenuItem control in the GotFocus event handler for the TextBox
controls.
B. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code-behind file for the window.
private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {
TextBox txtBox = sender as TextBox;
e.CanExecute = (txtBox.Text.Length > 0);
}
C. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code behind file for the window.
private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {
TextBox txtBox = e.Source as TextBox;
e.CanExecute = (txtBox.Text.Length > 0);
}
D. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code behind file for the window.
private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {
MenuItem menu = e.Source as MenuItem;
TextBox txtBox = menu.CommandTarget as TextBox;
Menu.IsEnabled = (txtBox.Text.Length > 0);
}
Answer: C
2. You create a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application is named EnterpriseApplication.exe.
You add the Win