可学答题网 > 问答 > MCPD(70-511)题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

You use Microsoft .NET Framework 4 to


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.
参考答案
参考解析:
分类:MCPD(70-511)题库
相关推荐

1、You use Microsoft .NET Framework 4 to

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.The application displays a list of books.You wri...

2、You use Microsoft .NET Framework 4 to

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.You add a property named ServiceContext to a co...

3、You use Microsoft .NET Framework 4 to

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.The application has multiple data entry windows....

4、You use Microsoft .NET Framework 4 to

You use Microsoft .NET Framework 4 to create a Windows Forms application.You plan to use a Windows Presentation Foundation (WPF) control of the...

5、You use Microsoft .NET Framework 4 to

You use Microsoft .NET Framework 4 to create a custom Windows Presentation Foundation (WPF) application.Your environment includes several WPF appl...

6、You use Microsoft .NET Framework 4 to

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.You write the following code fragment. (Line num...