PrepAway - Latest Free Exam Questions & Answers

Which XAML code fragment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You are creating an XAML page for the application. The page will display information about cars. The information is stored in a static resource named cars. You need to ensure that the page can display the image of each car in a ListBox control.
Which XAML code fragment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
<ListBox ItemsSource="{Binding Source={StaticResource cars}}">
<ListBoxItem>
<Image Source="{Binding Path=Path}"/>
</ListBoxItem>
</ListBox>

B.
<ListBox ItemsSource="{Binding Source={StaticResource cars}}">
<ListBoxItem>
<DataTemplate>
<Image Source="{Binding Path=Path}"/>
</DataTemplate>
</ListBoxItem>
</ListBox>

C.
<ListBox ItemsSource="{Binding Source={StaticResource cars}}">
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source="{Binding Path=Path}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

D.
<ListBox ItemsSource="{Binding Source={StaticResource cars}}">
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source="{Binding Source={StaticResource cars}, Path=Path}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>


Leave a Reply