单项选择题

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

You need to ensure that the ButtonHandler method is not executed when the user clicks the CancelButton button. 
Which code segment should you add to the code-behind file?()
 

A.
B.
C.
D.


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. 
You want to add an audio player that plays .wav or .mp3 files when the user clicks a button.  
You plan to store the name of the file to a variable named SoundFilePath. 
You need to ensure that when a user clicks the button, the file provided by SoundFilePath plays. 
What should you do?()

A. Write the following code segment in the button onclick event.     System.Media.    SoundPlayer player = new System.Media.    SoundPlayer(SoundFilePath); player.play();
B. Write the following code segment in the button onclick event.    MediaPlayer player = new MediaPlayer();     player.Open(new URI(SoundFilePath),    UriKind.Relative)); player.play();
C. Use the following code segment from the PlaySound()    Win32 API function and call the PlaySound function in the button onclick event.    [sysimport(dll="winmm.dll")]     public static extern long PlaySound(String SoundFilePath, long hModule, long dwFlags);
D. Reference the Microsoft.DirectX Dynamic Link Libraries.     Use the following code segment in the button onclick event.     Audio song = new Song(SoundFilePath);     song.CurrentPosition = song.Duration; song.Play();

2.单项选择题

You create a Windows client application by using Windows Presentation Foundation (WPF). 
The application contains the following code fragment.

You need to assign lbDetails to use the detail data template when btnDetails is clicked. 
Which code segment should you write for the click event handler for btnDetails?()

A. lbDetails.ItemsPanel.FindName("detail",lbDetails);
B. var tmpl = (ControlTemplate)FindResource("detail");    lbDetails.Template = tmpl; 
C. var tmpl = (DataTemplate)FindName("detail");    lbDetails.ItemTemplate = tmpl;
D. var tmpl = (DataTemplate)FindResource("detail");    lbDetails.ItemTemplate=tmpl;

4.单项选择题

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.

5.多项选择题

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.  
The application contains a composite user control that includes a TextBox control named txtInput.  
The user control will be hosted in a window and will have handlers for the text-changed event of txtInput. 
You need to ensure that the application meets the following requirements: 
AddHandler(TextBox.TextChangedEvent, new RoutedEventHandler(Audit_TextChanged), true);
Which of the following statments are TRUE ?()

A. A text-changed event handler, named Audit_TextChanged, was Created for the txtInput control.
B. Audit_TextChanged will stop running because the event is marked as handled by certain event handlers. 
C. Even through the event is marked handled by certain event handlers, Audit_TextChanged  will still run.
D. Audit_TextChanged will continue to run until the event is marked as handled.

最新试题

You upgrade a Windows Forms application to Microsoft .NET Framework 4. The application was developedby using a previous version of the .NET Framework. The application uses the Code Access Security (CAS) policy for file access. When the application is executed, you receive the following exception:  "NotSupportedException: This method uses CAS policy, which has been obsoleted by the .NET Framework." You need to resolve the error. What should you do?()

题型:单项选择题

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application that displays an image.You need to ensure that users can stretch and scale the image. Which control should you use?()

题型:单项选择题

You are developing a Windows Presentation Foundation (WPF) application for a travel reservation systemYou need to ensure that users can select a range of travel dates.What should you do ?()

题型:单项选择题

You are developing a Windows Presentation Foundation (WPF) application that displays opportunities from List<T.. class named Lead. The Lead class contains the properties Title and Revenue.You add a DataGrid control named dgQualifiedLeads to the MainWindow.xaml file. You set the ItemsSource property to Leads as follows.You need to ensure that CollectionViewSource is used to filter the list to display only Lead objects with revenue ...What should you do ?()

题型:单项选择题

You need to ensure that phone numbers are displayed in the following format : (###) ### - ###Which markup segment should you use ?()

题型:单项选择题

You use Microsoft Visual Studio 2010 and Microsoft . NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You create a WPF window in the application.  You add the following code segment to the application. public class ViewModel { public CollectionView Data { get; set; } }public class BusinessObject { public string Name { get; set; } }The DataContext property of the window is set to an instance of the ViewModel class.  The Data property of the ViewModel instance is initialized with a collection of BusinessObject objects. You add a TextBox control to the Window. You need to bind the Text property of the TextBox control to the Name property of the current item of the CollectionView of the DataContext object.  You also need to ensure that when a binding error occurs, the Text property of the TextBox control is set to N/A . Which binding expression should you use?()

题型:单项选择题

You use Microsoft .NET Framework 4 to create an application. The application performs resource-intensive calculations that consist of multiple layers of nested looping.The application will be deployed to servers that contain varying hardware configurations. You need to ensure that the application utilizes CPU resources on the server in the most efficient manner. You want to achieve this goal by using the minimum amount of code. What should you do?()

题型:单项选择题

You are developing a Windows Forms application that contains a DataGridView control. The DataGridView capture the customer's name, address, and phone number.You have been asked to provide data validation in a DataGridView to prevent users from leaving the..You need to ensure that users cannot tab out of the name field without entering dataWhat should you do ?()

题型:单项选择题

You create a Windows client application by using Windows Presentation Foundation (WPF). The application contains the following code fragment.You need to assign lbDetails to use the detail data template when btnDetails is clicked. Which code segment should you write for the click event handler for btnDetails?()

题型:单项选择题

You are developing a Windows Presentation Foundation (WPF) application.You need to display HTML content from a Web Page on the WPF form. What should you do?()

题型:单项选择题