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.
    this.errorProvider.DataSource = this.customerBindingSource;
  5. 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;

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.
< TextBox Text="{BindingPath=StringMember} " / >
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?

  1. <ListBox ItemsSource="{Binding Source={StaticResource pictures})"> <ListBox. ItemTeroplato <DataTemplate> <TextBlockXTextBlock.Text> <Binding Path="PictureFilePath" /> </TextBlock.TextX/TextBlock> </DataTemplate> </ListBox.ItemTemplate> </LiscBox>
  2. <ListBox ItemsSource-"{Binding Source-{StaticResoucce pictures})"> <ListBox. ItemTeroplato <DataTemplate> <Image Source="{Binding Source={StaticResource pictures}/ Path=PictureFilePath}"/> </DataTeroplate> </ListBox.ItemTemplate> </ListBox>
  3. <ListBox ItemsSource-"(Binding Source-{StaticResource pictures)} "> <ListBox. IteroTemplate> <DataTemplate> <TextBlockXTextBlock.Text> <Binding Path="Name" /> </TextBlock.Text></TextBlock> </DataTemplate> </ListBox. ItemTeroplato </LiscBox>
  4. <ListBox ItemsSource="(Binding Source{StaticResource pictures)>"> <ListBox. ItemTemplato <DataTemplate> <Iroage Source="{Binding Path=PictureFiiePath)"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox>

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?

  1. ordersBindingSource.DataSource = producxsBindingSource; ordersBindingSource.DataMember = "FK_Order_Details_Products"; productsBindingSource.Filter = "UnitPrice > 20"; productsBindingSource.Sort = ProductName";
  2. productsDataGridView.DataSource = ordersBindingSource; productsBindingSource.Filter = "UnitPrice > 20"; productsBindingSource.Sort = "ProductName";
  3. order DetailsBindingSource.DataSource = ordersBindingSource; order_DetailsBindingSource.DataMember = "FK_Order_Details_Orders". order_DetailsBindingSource .Filter = "UnitPrice > 20"; productsBindingSource.Sort "ProductName";
  4. order_DetailsDataGridViev.DataSource = ordersBindingSource; order_DetailsBindingSource.Filter = "UnitPrice > 20"; productsBindingSource.Sort "ProductName";

Correct Answer: 3

Tagged . Bookmark the permalink.

Leave a Reply