单项选择题

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

The TextBox control is data-bound to an instance of the Contact class. You plan to implement an ErrorTemplate in the TextBox control. 
You need to ensure that the validation error message is displayed next to the TextBox control. Which code fragment should you use?()

A.
B.
C.
D.


您可能感兴趣的试卷

你可能感兴趣的试题

2.多项选择题

You use Microsoft .NET Framework 4 to create a Windows Forms application. 
You add a new class named Customer to the application.  
You select the Customer class to create a new object data source. 
You add the following components to a Windows Form: 
A BindingSource component named customerBindingSource that is data-bound to the Customer object data source.
A set of TextBox controls to display and edit the Customer object properties.
Each TextBox control is data-bound to a property of the customerBindingSource component. 
An ErrorProvider component named errorProvider that validates the input values for each TextBox control. 
You need to ensure that the input data for each TextBox control is automatically validated by using the ErrorProvider component. 
Which two actions should you perform?()

A. Implement the validation rules inside the Validating event handler of each TextBox control by throwing an exception when the value is invalid.
B. Implement the validation rules inside the TextChanged event handler of each TextBox control by throwing an exception when the value is invalid.
C. Implement the validation rules inside the setter of each property of the Customer class by throwing an exception when the value is invalid.
D. Add the following code segment to the InitializeComponent method of the Windows Form.   this.errorProvider.DataSource = this.customerBindingSource;
E. Add the following code segment to the InitializeComponent method of the Windows Form.    this.errorProvider.DataSource = this.customerBindingSource.DataSource;    this.errorProvider.DataMember = this.customerBindingSource.DataMember;

5.单项选择题

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();

6.单项选择题

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;

8.单项选择题

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.

9.多项选择题

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 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 use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You need to ensure that users can view content in a book-reading format that displays two pages at a time. Which control should you use?()

题型:单项选择题

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code segment. (Line numbers are included for reference only.) the TextBox control is data-bound to an instance of the Contact class.  You need to ensure that the Contact class contains a business rule to ensure that the ContactName property is not empty or NULL.You also need to ensure that the TextBox control validates the input data. Which two actions should you perform?()

题型:多项选择题

You have a custom button, with should have a Property "IsActive", one must be able to bind this Property on a class Property.()

题型:单项选择题

You have definded a style in app.xamlYou want to use this style in your application in code behind.How can you achieve this? ()

题型:单项选择题

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) applicationThe application is for commercial use and requires a valid license key to be entered. You create a project type of Class Library code to validate license keysYou need to ensure that the user enters a valid license key during installation of the software.Which deployment should reference the class library?()

题型:单项选择题

You are developing a Windows Presentation Foundation (WPF) application that displays financial data. The following style is applied to every Label control that displays currency.You need to ensure that the style is updated to meet the following requirements regarding currency:- It must be right aligned- It must display the number with the regional currency settingsWhich setting should you use in the application manifest?()

题型:单项选择题

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.  The application displays a list of books. You write the following code fragment. (Line numbers are included for reference only.)You need to ensure that book titles that are out of stock appear in red.Which code fragment should you insert at line 12?()

题型:单项选择题

You use Microsoft .Net Framework 4 to create a Windows Form application.You created a new application, you then wrote the code below:Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCultureWhich of the following options are TRUE? ()

题型:单项选择题