PrepAway - Latest Free Exam Questions & Answers

Which two actions should you perform?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You plan to use the application to preview video files. You write the following XAML code fragment.

01 <Window x:Class="myClass" xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="myWindow" Height="300" Width="300">
02 <StackPanel Background="Black">
03
04 <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
05 <Button Name="btnPlay" Margin="10" Content="Play" />
06 </StackPanel>
07
08 </StackPanel>
09 </Window>

You need to ensure that the application plays only the first 10 seconds of a video that you want to preview.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

PrepAway - Latest Free Exam Questions & Answers

A.
Insert the following XAML fragment at line 03.
<MediaElement Name="myMediaElement" Stretch="Fill" />

B.
Insert the following XAML fragment at line 03.
<MediaElement Name="myMediaElement" Source="MediaFileSelected.wmv" Stretch="Fill" />

C.
Create the following method in the code-behind file.
public void PlayMedia(object sender, RoutedEventArgs args)
{
myMediaElement.Play();
}

D.
Insert the following XAML fragment at line 07.
<StackPanel.Triggers>
<EventTrigger RoutedEvent="Button.Click" SourceName="btnPlay">
<EventTrigger.Actions>
<BeginStoryboard Name= "myBegin">
<Storyboard SlipBehavior="Slip">
<MediaTimeline Source="MediaFileSelected.wmv" Storyboard.TargetName="myMediaElement" BeginTime="0:0:0" Duration="0:0:10" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</StackPanel.Triggers>

E.
Insert the following XAML fragment at line 07.
<StackPanel.Triggers>
<EventTrigger RoutedEvent="Button.Click" SourceName="btnPlay">
<EventTrigger.Actions>
<BeginStoryboard Name= "myBegin">
<Storyboard SlipBehavior="Slip">
<MediaTimeline Storyboard.TargetName="myMediaElement" BeginTime="0:0:0" Duration="0:0:10" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</StackPanel.Triggers>


Leave a Reply