- 单项选择题 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?()
A、 Create an event handler for the CanExecuteChanged event of the AddSugarCommand command. Call the CanAddSugar method from within the event handler.
B、 Inherit the AddSugarCommand from the RoutedUICommand class instead of the RoutedCommand class. Call the CanAddSugar method from within the constructor of the AddSugarCommand command.
C、 Add a CommandBinding object to the CommandBinding property of the MenuItem control. Set the CanExecute property of the CommandBinding object to the CanAddSugar method.
D、 Add a CommandBinding object to the CommandBindings property of the window. Set the Command property of CommandBinding to the AddSugarCommand command. Set the CanExecute property of the CommandBinding object to the CanAddSugar method.
- D
关注下方微信公众号,在线模考后查看
- Rate your level of p
- You are a
- You are the network
- Your company&e
- You have
- 您在运行 Windows
- 公司A有两个名为SQL1和SQL2的SQ
- Your company&r
- Your company runs R
- You create a Web app
- You have
- You deploy&ens
- 您正在为一个客户进行财务报表。您的客户在
- 你是TestKing网站的技术员,你的W
- 您正在使用MicrosoftVisual
- You write a Web appl
- 你是TestKing网站的所有Windo
- Your network&e
- You are t
- 您是公司的网络管理员。公司网络由一个单一