Which XAML fragment should you use?

You are developing a Silverlight 4 application. The application contains a TextBox control data bound to a class that implements only the INotifyPropertyChanged interface. When an invalid value is entered in the TextBox control, the class will throw a ValidationException in the Set block of its Name property. You need to display the validation error when an invalid value is entered in the TextBox control. Which XAML fragment should you use?

You are developing a Silverlight 4 application. The application contains a TextBox control data bound to a class that implements only the INotifyPropertyChanged interface. When an invalid value is entered in the TextBox control, the class will throw a ValidationException in the Set block of its Name property. You need to display the validation error when an invalid value is entered in the TextBox control. Which XAML fragment should you use?

A.
<TextBox Text=”{Binding Name, Mode=TwoWay, ValidatesOnExceptions=True}” />

B.
<TextBox Text=”{Binding Name, Mode=OneWay, ValidatesOnExceptions=True}” />

C.
<TextBox Text=”{Binding Name, Mode=TwoWay, NotifyOnValidationError=True}” />

D.
<TextBox Text=”{Binding Name, Mode=OneWay, NotifyOnValidationError=True}” />



Leave a Reply 0

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