You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You write the following code segment.
(Line numbers are included for reference only.)
01 StackPanel stack = new StackPanel();
02 Content = stack;
03 Button btOpen = new Button();
04 btOpen.Content = "Open";
05 Setter setter = new Setter(Button.BackgroundProperty, Brushes.Blue);
06 Style style = new Style();
07 style.Setters.Add(setter);
08 stack.Children.Add(btOpen);
09
You need to ensure that the Button control has a blue background.
Which line of code should you insert at line 09?
A.
stack.Resources.Add("Button", style);
B.
stack.Resources.Add(btOpen.GetType(), style);
C.
stack.Resources.Add("{x:Type Button}", style);
D.
stack.Resources.Add("System.Windows.Control.Button", style);