Q9. You are creating a Windows Presentation Foundation application to track customer orders.

You use Microsoft .NET Framework 3.5 to create the application. The application contains an Order class. The Order class has two public properties named OrderDate and OrderID. The application also contains an ObservableCollection collection of Order objects. This collection is named OrderItems. You write the following XAML code fragment.

You add two ListBox controls to select orders based on the OrderID or the OrderDate properties. One ListBox control displays order dates and the other ListBox control displays order numbers. You need to bind the two ListBox controls so that the item selected in one control is reflected in the other control.

Q10. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.

You are creating an XAML page for the application. The page will display information about cars. The information is stored in a static resource named cars. You need to ensure that the page can display the image of each car in a ListBox control.

Which XAML code fragment should you use?

A.<ListBox ItemsSource="{Binding Source={StaticResource cars}}">

<ListBoxItem>

<Image Source="{Binding Path=Path}"/>

</ListBoxItem>

</ListBox>

B.<ListBox ItemsSource="{Binding Source={StaticResource cars}}">

<ListBoxItem>

<DataTemplate>

<Image Source="{Binding Path=Path}"/>

</DataTemplate>

</ListBoxItem>

</ListBox>

C.<ListBox ItemsSource="{Binding Source={StaticResource cars}}">

<ListBox.ItemTemplate>

<DataTemplate>

<Image Source="{Binding Path=Path}"/>

</DataTemplate>

</ListBox.ItemTemplate>

</ListBox>

D.<ListBox ItemsSource="{Binding Source={StaticResource cars}}">

<ListBox.ItemTemplate>

<DataTemplate>

<Image Source="{Binding Source={StaticResource cars}, Path=Path}"/>

</DataTemplate>

</ListBox.ItemTemplate>

</ListBox>

Answer: C

Approved 70-502 :

Q11. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.

You add textbox controls to the user interface of the application.

You need to set the format for each textbox control in the following manner:

The font is Segoe UI.

The font size is 16.

Which XAML code fragment should you use?

A.<Style x:Key="MyTextBoxStyle">

<Setter Property="TextBox.FontSize" Value="16" />

<Setter Property="TextBox.FontFamily" Value="Segoe UI" />

</Style>...

<TextBox Style="{DynamicResource MyTextBoxStyle}">

...

</TextBox>

B.<Style BasedOn="MyTextBoxStyle" x:Key="TextBox">

<Setter Property="TextBox.FontSize" Value="16" />

<Setter Property="TextBox.FontFamily" Value="Segoe UI" />

</Style>

<TextBox FontStyle="{DynamicResource MyTextBoxStyle}">

...

</TextBox>

C.<Style x:Name="MyTextBoxStyle" x:Key="TextBox">

<Setter Property="TextBox.FontSize" Value="16" />

<Setter Property="TextBox.FontFamily" Value="Segoe UI" />

</Style>...

<TextBox Style="{DynamicResource MyTextBoxStyle}">

...

</TextBox>

D.<Style x:Name="MyTextBoxStyle" x:Key="TextBox">

<Setter Property="TextBox.FontSize" Value="16" />

<Setter Property="TextBox.FontFamily" Value="Segoe UI" />

</Style>...

<TextBox FontStyle="{DynamicResource MyTextBoxStyle}">

...

</TextBox>

Answer: A

Q12. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.

The application displays an image that is defined as an application resource.

You need to ensure that the following requirements are met:

The image file must appear in the output directory after the build.

The image can be modified without being rebuilt.

What should you do?

A.Include the image in your project. Set the Build Action property for the file to Resource.

Set the Copy to Output Directory property to Copy if newer.

B.Include the image in your project. Set the Build Action property for the file to Content.

Set the Copy to Output Directory property to Copy if newer.

C.Include the image in your project. Set the Build Action property for the file to Embedded Resource.

Set the Copy to Output Directory property to Copy always.

D.Include the image in your project. Set the Build Action property for the file to ApplicationDefinition.

Set the Copy to Output Directory property to Copy if newer.

Answer: B

Q13. You are creating a Windows Presentation Foundation application to track inventory levels.

You use Microsoft .NET Framework 3.5 to create the application. You need to create a Product class to propagate changes from the InventoryLevel property to the InventoryLevel label control.

Which code segment should you use?

A.public class Product

{

private int _inventoryLevel;

public int InventoryLevel

{

get { return _inventoryLevel; }

set { _inventoryLevel = value; }

}

}

B.public class Product : DependencyObject

{

private int _inventoryLevel;

public int InventoryLevel

{

get { return _inventoryLevel; }

set { _inventoryLevel = value; }

}

}

C.public class Product

{

public event EventHandler PropertyChanged;

private int _inventoryLevel;

public int InventoryLevel

{

get { return _inventoryLevel; }

set

{

_inventoryLevel = value;

PropertyChanged(this, EventArgs.Empty);

}

}

}

D.public class Product : INotifyPropertyChanged

{

public event PropertyChangedEventHandler PropertyChanged;

private int _inventoryLevel;

public int InventoryLevel

{

get { return _inventoryLevel; }

set

{

_inventoryLevel = value;

PropertyChanged(this, new PropertyChangedEventArgs("InventoryLevel"));

}

}

}

Answer: D

Q14. Your company has deployed a Windows Presentation Foundation application on client computers by using the ClickOnce technology.

The application interrupts the users in their tasks by prompting them to look for updates. You need to ensure that the application automatically detects updates without blocking the users interaction with the application.

What should you do?

A.Call the ApplicationDeployment.CheckForUpdate() function from the startup routine of the application.

B.Add an expiration element to the deployment manifest file. Set the maximumAge attribute to 24 and the unit attribute to hour.

C.Add the beforeApplicationStartup element to the deployment manifest file.

Configure a schedule job to launch another instance of the application in the background once a day.

D.Add a System.Windows.Threading.DispatcherTimer object and the ApplicationDeployment.CheckForUpdateAsync() function to the code-behind file.

Set the Interval property of the System.Windows.Threading.DispatcherTimer object to 1 day.

Answer: D

Q15. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.

You use a template for button controls. The template is defined as a resource on the page that contains the button controls. The template has a key named tpCancel. You plan to add a button named Cancel to the user interface of the application. You need to ensure that the Cancel button uses the template.

Which code segment should you use?

A.<Button Template="tpCancel">Cancel</Button>

B.<Button Template="{StaticResource tpCancel}">Cancel</Button>

C.<Button>

<Button.Template>

<ControlTemplate x:Name="tpCancel" />

</Button.Template>

Cancel

</Button>

D.<Button>

<Button.Template>

<ControlTemplate Resources="tpCancel" />

</Button.Template>

Cancel

</Button>

Answer: B

Q16. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.

You create a window by using the following XAML code fragment.

(Line numbers are included for reference only.)

01 <Rectangle x:Name="rect">

02 <Rectangle.Fill>

03 <SolidColorBrush x:Name="brush"/>

04 </Rectangle.Fill>

05 <Rectangle.Triggers>

06 <EventTrigger RoutedEvent="Rectangle.Loaded">

07 <BeginStoryboard x:Name="beginName">

08 <Storyboard x:Name="boardName">

09

10 </Storyboard>

11 </BeginStoryboard>

12 </EventTrigger>

13 <EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">

14

15 </EventTrigger>

16 </Rectangle.Triggers>

17 </Rectangle>

You need to ensure that the animation starts when the rectangle is loaded. You also need to ensure that the animation terminates when a user clicks the rectangle.