Exam 70-511 : Windows Applications Development with Microsoft .NET Framework 4 Part – 9

Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application has a window with a canvas element. You need to draw a black line that has rounded edges at each end. Which code fragment should you use?

  1. <Line X1="10" Y1="10" X2="250" Y2="250" Fill="Black" StrokeThickness="15" UseLayoutRounding="True"/>
  2. <Line X1="10" Y1="10" X2="250" Y2="250" Stroke="Black" StrokeThickness="15" StrokeEndLineCap="Round" StrokeStartLineCap="Round" />
  3. <Line X1="10" Y1="10" X2="250" Y2="250" Fill="Black" StrokeThickness="15" StrokeLineJoin="Round" />
  4. <Line X1="10" Y1="10" X2="250" Y2="250" Stroke="Black" StrokeThickness="15" StrokeDashCap="Round" />

Correct Answer: 2


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment. (Line numbers are included for reference only.)
01<Page xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
02xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
03x:Class=”MyCompany.MediaConrols” >
04<StackPanel Background=”Black”>
05<StackPanel HorizontalAlignment=”Center” Width=”450″ Orientation=”Horizontal”>
06
07<!– Play button. –>
08<Image Source=”imagesUI_play.gif” MouseDown=”OnMouseDownPlayMedia” Margin=”5″ />
09<!– Pause button. –>
10<Image Source=”imagesUI_pause.gif” MouseDown=”OnMouseDownPauseMedia” Margin=”5″ />
11<!– Stop button. –>
12<Image Source=”imagesUI_stop.gif” MouseDown=”OnMouseDownStopMedia” Margin=”5″ />
13</StackPanel>
14</StackPanel>
15</Page>
You need to ensure that a video file begins to play only when a user clicks Play. Which code fragment should you insert at line 06?

  1. <MediaElement Source="medianumbers.wmv" Name="myMediaElement" Width="450" Height="250"
    LoadedBehavior="Play" UnloadedBehavior="Stop" Stretch="Fill"/>
  2. <MediaElement Source="medianumbers.wmv" Name="myMediaElement" Width="450" Height="250"
    LoadedBehavior="Manual" UnloadedBehavior="Stop" Stretch="Fill"/>
  3. <MediaPlayer Source="medianumbers.wmv" Name="myMediaElement" Width="450" Height="250"
    LoadedBehavior="Play" UnloadedBehavior="Stop" Stretch="Fill"/>
  4. <MediaPlayer Source="medianumbers.wmv" Name="myMediaElement" Width="450" Height="250"
    LoadedBehavior="Manual" UnloadedBehavior="Stop" Stretch="Fill"/>

Correct Answer: 2


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application that displays a high-resolution graphic image named Image1.jpg. You need to limit the width of the image to 200 pixels. You also need to preserve the aspect ratio of the image. Which code fragment should you use?

  1. <Image Width="200" Source="Image1.jpg"/> <Image Width="200" Height="200" Source="Image1.jpg"/>
    <Image Width="200"> <Image.Source>
  2. <BitmapImage DecodePixelWidth="200" DecodePixelHeight="200" UriSource="Image1.jpg" />
    </Image.Source>
  3. </Image> <Image Width="200">
    <Image.Source>
  4. <BitmapImage DecodePixelWidth="200" UriSource="Image1.jpg" />
    </Image.Source> </Image>

Correct Answer: 4


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment. (Line numbers are included for reference only.)
01<StackPanel>
02<StackPanel.Resources>
03<ControlTemplate
04TargetType=”{x:Type Button}”
05x:Key=”btn”>
06
07</ControlTemplate>
08</StackPanel.Resources>
09<Button Content=”Save”
10Template=”{StaticResource btn}” />
11<Button Template=”{StaticResource btn}”>
12<TextBox Text=”Save” />
13</Button>
14</StackPanel>
You need to ensure that both Button controls display the “Save” text. Which code fragment should you insert at line 06?

  1. <TextBlock Text="{Binding}" />
  2. <TextBlock Text="{TemplateBinding Content}" />
  3. <ContentPresenter Content="{Binding}" />
  4. <ContentPresenter />

Correct Answer: 4


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You create a Button control for the application. You need to ensure that the application meets the following requirements:

  • When the mouse pointer is over the Button control, the background color of the button is set to red and the Button control appears bigger.
  • When the mouse pointer is not over the Button control, the button returns to its original state.

What should you do?

  1. Create a template. Declare a VisualState element in the template.
  2. Create a StoryBoard animation. Add an EventTrigger class to the Button control that begins the StoryBoard animation.
  3. Create a ScaleTransform class. Bind the ScaleX and ScaleY properties of the Button control to the Background property by using a custom value converter.
  4. Add a method named ChangeAppearance in the code-behind file. Subscribe the ChangeAppearance method to the MouseEnter event of the Button control.

Correct Answer: 1

Tagged . Bookmark the permalink.

Leave a Reply