nerdexam
Microsoft

70-511 · Question #38

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 HyStyle)">Hello World</TextBlock> <Button Style="{StaticResource HyStyle}">Ok</Button> </StackPonel> 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

(47 responses)
  • A
    4% (2)
  • B
    70% (33)
  • C
    9% (4)
  • D
    17% (8)

Community Discussion

No community discussion yet for this question.

Full 70-511 Practice