Which code segment should you insert at line 03?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application contains a data source and a TextBox control named txtUnitPrice. The Text property of the txtUnitPrice control is bound to the data source by using two-way binding. You write the following code segment.

01 private void OverridePrice(decimal newPrice)
02 {
03
04 txtUnitPrice.Text = newPrice;
05 }
You need to ensure that after the OverridePrice method is called, changes to the data source do not propagate to txtUnitPrice.
Which code segment should you insert at line 03?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application contains a data source and a TextBox control named txtUnitPrice. The Text property of the txtUnitPrice control is bound to the data source by using two-way binding. You write the following code segment.

01 private void OverridePrice(decimal newPrice)
02 {
03
04 txtUnitPrice.Text = newPrice;
05 }
You need to ensure that after the OverridePrice method is called, changes to the data source do not propagate to txtUnitPrice.
Which code segment should you insert at line 03?

A.
txtUnitPrice.Clear();

B.
txtUnitPrice.DataContext = null;

C.
BindingOperations.ClearBinding(txtUnitPrice, TextBox.TextProperty);

D.
Binding binding = BindingOperations.GetBinding(txtUnitPrice, TextBox.TextProperty);
binding.NotifyOnSourceUpdated = False



Leave a Reply 0

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