You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
The application displays a list of books.
You write the following code fragment. (Line numbers are included for reference only.)
01<Window.Resources>
02<XmlDataProvider x:Key=”InventoryData” XPath=”Books”>
03<x:XData>
04<Books xmlns=””>
05<Book Title=”XML in Action” Stock=”in” />
06<Book Title=”Inside C#” Stock=”out” />
07<Book Title=”Introducing Microsoft .NET” Stock=”in”/>
08</Books>
09</x:XData>
10 </XmlDataProvider>
11<Style x:Key=”MyItemStyle” TargetType=”{x:Type ListBoxItem}”>
12
13</Style>
14</Window.Resources>
15<ListBox ItemContainerStyle=”{StaticResource MyItemStyle}”>
16<ListBox.ItemsSource>
17<Binding Source=”{StaticResource InventoryData}” XPath=”Book”/>
18</ListBox.ItemsSource>
19<ListBox.ItemTemplate>
20<DataTemplate>
21<TextBlock>
22<TextBlock.Text>
23<Binding XPath=”@Title”/>
24</TextBlock.Text>
25</TextBlock>
26</DataTemplate>
27</ListBox.ItemTemplate>
28</ListBox>
You need to ensure that book titles that are out of stock appear in red.
Which code fragment should you insert at line 12?
A.
<Style.Triggers>
<Trigger Binding.XmlNamespaceManager=”{Binding XPath=@Stock}” Value=”out”>
<Setter Property=”Foreground” Value=”Red” />
</Trigger>
</Style.Triggers>
B.
<Style.Triggers>
<Trigger Binding =”{Binding XPath=@Stock}” Value=”out”>
<Setter Property=”Foreground” Value=”Red”/>
<DataTrigger>
</Style.Triggers>
C.
<Style.Triggers>
<Trigger Binding.XmlNamespaceManager=”{Binding XPath=book@Stock}” Value=”out”>
<Setter Property=”Foreground” Value=”Red” />
<DataTrigger>
</Trigger>
</Style.Triggers>
D.
<Style.Triggers>
<Data Trigger Binding=”{Binding XPath=book@Stock}” Value=”out”>
<Setter Property=”Foreground” Value=”Red” />
<DataTrigger>
</Style.Triggers>