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.
You declare a class named PictureContainer that has a property named Photo.
The Photo property is of the byte[] type and contains an image in the JPEG format.
You assign a collection of the PictureContainer elements to the current DataContext.
You need to create a ListBox control that displays the images.
Which code fragment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
<ListBox DisplayMemberPath=”Photo” />

B.
<ListBox DisplayMemberPath=”{Binding Photo}” />

C.
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source=”{Binding Photo}” />
</DataTemplate>
</ListBox.ItemTemplate>

D.
<ListBox.Resources>
<Style TargetType=”{x:Type ListBoxItem}”>
<Setter Property=”Content”>
<Setter.Value> <Image Source=”{Binding Photo}” />
</Setter.Value>
</Setter>
</Style>
</ListBox.Resources>


Leave a Reply