PrepAway - Latest Free Exam Questions & Answers

Which code fragment should you use?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
The application contains three text boxes named txtAddress, txtCity, and txtState.
You need to ensure that the postal code is automatically set based on the information typed by users in the text boxes.
You also need to ensure that the complete address is displayed in a TextBlock control.
Which code fragment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
<TextBlock DataContext=”txtAddress”>
<TextBlock.Text>
<Binding Path=”Text” Converter=”{StaticResource adrsConverter}”/>
</TextBlock.Text>
</TextBlock>
<TextBlock DataContext=”txtCity”>
<TextBlock.Text>
<Binding Path=”Text” Converter=”{StaticResource cityConverter}”/>
</TextBlock.Text>
</TextBlock>
<TextBlock DataContext=”txtState”>
<TextBlock.Text>
<Binding Path=”Text” Converter=”{StaticResource stateConverter}”/>
</TextBlock.Text>
</TextBlock>

B.
<TextBlock Margin=”10″ Name=”textBlock”>
<TextBlock.Text>
<MultiBinding Converter=”{StaticResource myConverter}”>
<Binding ElementName=”txtAddress” Path=”Value”/>
<Binding ElementName=”txtCity” Path=”Value”/>
<Binding ElementName=”txtState” Path=”Value”/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>

C.
<TextBlock Margin=”10″ Name=”textBlock”>
<TextBlock.Text>
<MultiBinding Converter=”{StaticResource myConverter}”>
<Binding ElementName=”txtAddress” Path=”Text”/>
<Binding ElementName=”txtCity” Path=”Text”/>
<Binding ElementName=”txtState” Path=”Text”/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>

D.
<TextBlock DataContext=”txtAddress”>
<TextBlock.Text>
<Binding Path=”Value” Converter=”{StaticResource adrsConverter}”/>
</TextBlock.Text>
</TextBlock>
<TextBlock DataContext=”txtCity”>
<TextBlock.Text>
<Binding Path=”Value” Converter=”{StaticResource cityConverter}”/>
</TextBlock.Text>
</TextBlock>
<TextBlock DataContext=”txtState”>
<TextBlock.Text>
<Binding Path=”Value” Converter=”{StaticResource stateConverter}”/>
</TextBlock.Text>
</TextBlock>


Leave a Reply