ToShow
. You wish to have a field that will only be shown to the user if the bound ToShow
property returns true
. Which code segment should you use?a. Only implement the Convert
method with the following code snippet:
if (value != null) { bool result = (Boolean)value; return result == true ? Visibility.Visible : Visibility.Collapsed; return result == true ? Visibility.Visible : Visibility.Collapsed; } return Visibility.Collapsed;
b. Only implement the ConvertBack
method with the following code snippet:
if (value != null) { bool result = (Boolean)value; return result == true ? Visibility.Visible : Visibility.Collapsed; } return Visibility.Collapsed;
c. Only implement the Convert
method with the following code snippet:
if (value != null) { bool result = (Boolean)value; return result; } return Visibility.Collapsed;
d. Only implement the ConvertBack
method with the following code snippet:
if (value != null) { bool result = (Boolean)value; return result; } return Visibility.Collapsed;
TextBox
control that is data bound to a property in a class that implements the INotifyPropertyChanged
interface. When an invalid value is entered to the TextBox
, the property throws an exception. You need to display the error message the property throws to the user. Which code segment should you use?a.<TextBox Text="{Binding ZipCode,Mode=TwoWay,ValidatesOnDataErrors=True}"/>
b.<TextBox Text="{Binding ZipCode,Mode=OneWay,ValidatesOnDataErrors=True}"/>
c.<TextBox Text="{Binding ZipCode,Mode=TwoWay,ValidatesOnExceptions=True}"/>
d.<TextBox Text="{Binding ZipCode,Mode=TwoWay,NotifyOnValidationError=True}"/>
TextBlock
control that is bound to a property called FirstName
. The TextBlock
control needs to display the string "Welcome back" before the value of FirstName
. Which code segment should you use?a.<TextBlock Text="{Binding FirstName,StringFormat='Welcome back {FirstName}'}"/>
b.<TextBlock Text="{Binding FirstName,StringFormat='Welcome back {0}'}"/>
c.<TextBlock Text="Welcome back {Binding FirstName}"/>
d.<TextBlock Text="{Binding FirstName,ConverterParameter='Welcome back {0}'}"/>
Degrees
and its values are between 1 and 360. You need to display the value of the control in a TextBlock
control. Which code segment should you use?a.<TextBlock Text="{Binding Path=Value, ElementName=Degrees}"/>
b.<TextBlock Text="{Binding Path=Value, Converter=Degrees}"/>
c.<TextBlock DataContext="Degrees" Text="{Binding Path=Value}"/>
d.<TextBlock Text="{Binding Path=Degree, ElementName=Degrees}"/>
TotalPrice
. The field must be read-only, and it should not update the backend property. When a user updates other fields in the application, TotalPrice
changes and needs to update the UI layer. Which binding mode should you use?a. TwoWay
b. OneTime
c. None
c. OneWay
18.223.172.132