Exam 70-511 : Windows Applications Development with Microsoft .NET Framework 4 Part – 18

Question: 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? (Each correct answer presents part of the solution. Choose two.)

  1. Implement the validation rules inside the Validating event handler of each TextBox control by throwing an exception when the value is invalid.
  2. Implement the validation rules inside the TextChanged event handler of each TextBox control by throwing an exception when the value is invalid.
  3. Implement the validation rules inside the setter of each property of the Customer class by throwing an exception when the value is invalid.
  4. Add the following code segment to the InitializeComponent method of the Windows Form.
  5. Add the following code segment to the InitializeComponent method of the Windows Form.

Correct Answer: 3 & 4


Question: You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains a ListBox control named IbxItems that is data-bound to a collection of objects. Each object has a DisplayValue property. You add a Button control to the application. You need to ensure that the Content property of the Button control is data-bound to the DisplayValue property of the selected item of IbxItems. Which binding expression should you use?

  1. {Binding ElementName= IbxItems, Source=SelectedItem, Path=DisplayValue}
  2. {Binding Source=lbxItems, ElementName=SelectedItem, Path=DisplayValue}
  3. {Binding ElementName=lbxItems, Path=SelectedItem.DisplayValue}
  4. {Binding Source=lbxItems, Path=SelectedItem.DisplayValue}

Correct Answer: 3


Question: You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment.

You need to ensure that the StringMember property of the data-bound object is updated immediately when the user types in the TextBox control. Which binding expression should you use?

  1. { Binding Path=StringMember, Mode=TwoWay }
  2. { Binding Path=StringMember, NotifyOnSourceUpdated=True }
  3. { Binding Path-StringMember, NotifyOnTargetUpdated=True }
  4. { Binding Path=StringMember, UpdateSourceTrigger=PropertyChanged }

Correct Answer: 4


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You add a ListBox control to the application. The ListBox control is data-bound to an instance of a custom collection class of the Product objects named ProductList. The number of items of the data-bound collection is fixed. However, users can modify the properties of each of the Product objects in the collection. You need to ensure that changes made on the Product objects are automatically reflected in the ListBox control. What should you do?

  1. Implement the INotifyPropertyChanged interface in the Product class.
  2. Implement the INotifyCollectionChanged interface in the ProductList class.
  3. Set the Mode property of the Binding object of the ListBox control to TwoWay.
  4. Set the UpdateSourceTrigger property of the Binding object of the ListBox control to PropertyChanged.

Correct Answer: 1


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment. You need to implement the MyProject.MyConverter class. What should you do?

  1. Implement the IValueConverter interface.
  2. Implement the IMultiValueConverter interface.
  3. Inherit from the TypeConverter class.
  4. Apply the TypeConverterAttribute attribute.

Correct Answer: 1


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains an ObservableCollection object named Pictures that contains several Picture objects. Each Picture object contains the Name and PictureFilePath properties. You add a ListBox control to the application. You need to ensure that the pictures are displayed in the ListBox control. Which code fragment should you use?

Correct Answer: 4


Question: You use Microsoft .NET Framework 4 to create a Windows Forms application. You have a dataset as shown in the following exhibit. You plan to add a DataGridView to display the dataset. You need to ensure that the DataGridView meets the following requirements:

  • Shows Order Details for the selected order.
  • Shows only Order Details for items that have UnitPrice greater than 20
  • Sorts Products by ProductName

Which code segment should you use?

Correct Answer: 3

Tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.