Microsoft
70-511 · Question #62
70-511 Question #62: Real Exam Question with Answer & Explanation
Sign in or unlock 70-511 to reveal the answer and full explanation for question #62. The question stem and answer options stay visible for context.
Question
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You create a window that contains a Button control and a MenuItem control. Both controls are labeled "Add sugar." The Command properties of the Button and MenuItem controls are set to the same RoutedCommand named AddSugarCommand. You write the following code segment. private void CanAddSugar (object sender, CanExecuteRoutedEventArgs e) { ... } You need to ensure that when the CanAddSugar method sets e.CanExecute to false, the MenuItem and Button controls are disabled. What should you do?
Options
- ACreate an event handler for the CanExecuteChanged event of the AddSugarCommand
- BInherit the AddSugarCommand from the RoutedUICommand class instead of the
- CAdd a CommandBinding object to the CommandBinding property of the MenuItem control.
- DAdd a CommandBinding object to the CommandBindings property of the window.
Unlock 70-511 to see the answer
You've previewed enough free 70-511 questions. Unlock 70-511 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.