nerdexam
Microsoft

70-511 · Question #164

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains the following code fragment. <StackPanel> <TextBlock Style="{StaticResource…

The correct answer is B. <Style x:Key="MyStyle" TargetType="{ x : Type Framework-Element} ">. See the full explanation below for the reasoning.

Question

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains the following code fragment. <StackPanel> <TextBlock Style="{StaticResource MyStyle)">Hello World</TextBlock> <Button Style="{StaticResource MyStyle} ">Ok</Button> </StackPanel> You need to define a style that applies the following properties to the text in the StackPanel object:

FontSize = 32 FontWeight = Bold Which code fragment should you use?

Options

  • A<Style x:Key="MyStyle" TargetType-"{x:Type Control}">
  • B<Style x:Key="MyStyle" TargetType="{ x : Type Framework-Element} ">
  • C<Style x:Key="MyStyle" TargetType="{x:Type TextElement}">
  • D<Style x:Key="MyStyle" TargetType-"{x:Type UserControl)">

How the community answered

(37 responses)
  • A
    16% (6)
  • B
    73% (27)
  • C
    8% (3)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 70-511 Practice