nerdexam
Microsoft

70-355 · Question #54

You want to animate the background color of a StackPanel in a Universal Windows Platform (UWP) app whenever the panel receives the focus. Which code snippet should you use to perform the animation?

The correct answer is C. <StackPanel GotFocus="OnPanelHover"> <StackPanel.Resources> <Storyboard x:Name="AnimatePanel"> <ColorAnimation Storyboard.TargetName="PanelBrush" Storyboard.TargetProperty="Color" From="Blue" To="Aqua" Duration="0:0:10" /> </Storyboard> </StackPanel.Resources> <StackPanel.Background> <SolidColorBrush x:Name="PanelBrush" Color="Blue"/> </StackPanel.Background> </StackPanel>. See the full explanation below for the reasoning.

Question

You want to animate the background color of a StackPanel in a Universal Windows Platform (UWP) app whenever the panel receives the focus. Which code snippet should you use to perform the animation?

Options

  • A<StackPanel GotFocus="OnPanelHover"> <Storyboard x:Name="AnimatePanel"> <ColorAnimation Storyboard.TargetName="PanelBrush" Storyboard.TargetProperty="Color" From="Blue" To="Aqua" Duration="0:0:10" /> </Storyboard> <StackPanel.Background> <SolidColorBrush x:Name="PanelBrush" Color="Blue"/> </StackPanel.Background> </StackPanel>
  • B<StackPanel GotFocus="OnPanelHover"> <StackPanel.Resources> <Storyboard x:Name="AnimatePanel"> <ColorAnimation Storyboard.TargetName="PanelBrush" Storyboard.TargetProperty="Color" From="Blue" To="HAqua" Duration="0:0:10" /> </Storyboard> </StackPanel.Resources> <StackPanel.Background> <SolidColorBrush x:Name="Pane lBrush" Color="Blue"/> </StackPanel.Background> </StackPanel>
  • C<StackPanel GotFocus="OnPanelHover"> <StackPanel.Resources> <Storyboard x:Name="AnimatePanel"> <ColorAnimation Storyboard.TargetName="PanelBrush" Storyboard.TargetProperty="Color" From="Blue" To="Aqua" Duration="0:0:10" /> </Storyboard> </StackPanel.Resources> <StackPanel.Background> <SolidColorBrush x:Name="PanelBrush" Color="Blue"/> </StackPanel.Background> </StackPanel>
  • D<StackPanel GotFocus="OnPanelHover"> <StackPanel.Resources> <Storyboard x:Name="AnimatePanel"> <ColorAnimation Storyboard.TargetName="PanelBrush" Storyboard.TargetProperty="Color" From="Blue" To="Aqua" Duration="0:0:10" /> </Storyboard> </StackPanel.Resources> <StackPanel.Background> <SolidColorBrush x:Name="Pane lBrush" Color="Blue"/> </StackPanel.Background> </StackPanel>

How the community answered

(30 responses)
  • A
    17% (5)
  • B
    3% (1)
  • C
    73% (22)
  • D
    7% (2)

Community Discussion

No community discussion yet for this question.

Full 70-355 Practice