Learn About Microsoft .NET Framework 3.5
By Certification Magazine —
1 | 2 | 3 |The following are questions from MeasureUp’s Practice Test to help you prepare for the C# version of Microsoft Exam 70-502: Microsoft .NET Framework 3.5: Windows Presentation Foundation (WPF) Application Development
The audience for this exam includes individuals responsible for developing Windows-based software applications. Experience using Visual Studio 2008 and .NET Framework 3.5 and in developing and deploying WPF applications will help you prepare for this exam. MeasureUp offers practice tests for both the C# version and the VB version of this exam.
Objective: Configure and deploy WPF applications.
Sub-objective: Manage upgrades.
Single answer, multiple-choice
You recently deployed version 1.0.0.0 of a Microsoft Windows Presentation Foundation (WPF) application by using ClickOnce. You now deploy version 1.0.2.0 of the same application to a different location. The following files exist:
• Crm.exe
• Crm.exe.config
• Crm.application
• Crm.exe.manifest
• Crm.exe.config.deploy
You need to require users who recently installed the application to use the new version. What should you do?
A. Specify the following data in the Crm.application file:
B. Specify the following data in the Crm.exe.manifest file:
C. Specify the following data in the Crm.exe.config.deploy file:
D. Specify the following data in the Crm.exe.config file:
Answer:
A
Tutorial:
You should specify the following data in the Crm.application file:
This configures the deployment manifest to require users to use version 1.0.2.0 of the application. Because the beforeApplicationStartup element is specified as a child of the update element, the application will check for updates before it starts. This helps ensure the user does not launch a previous version of the application.
You should not specify the following data in the Crm.exe.manifest file:
This file represents the application manifest. To configure updates, you must modify the deployment manifest. The application manifest stores information about the application, such as required permissions, associated files and dependencies.
You should not specify the following data in the Crm.exe.config.deploy file:
This file represents a deployment file for Crm.exe.config.
You should not specify the following data in the Crm.exe.config file:
This file represents an application configuration file.
References:
Choosing a ClickOnce Update Strategy, MSDN, http://msdn2.microsoft.com/en-us/library/s22azw1e.aspx
Introduction to ClickOnce Deployment, MSDN, http://msdn2.microsoft.com/en-us/vbasic/ms789088.aspx
Objective: Create a WPF application.
Sub-objective: Configure page-based navigation.
Single answer, multiple-choice
You are developing a Microsoft WPF application. An Extensible Application Markup Language (XAML) page named Invoice.xaml uses the following code-behind class definition:
public partial class Invoice : Page
{
public Invoice(int invoiceNumber)
{
}
}
This page allows users to view an invoice. The value passed to the constructor determines the invoice the page should display. You need to use a Hyperlink control on another page to navigate to the invoice page and display invoice 100. What should you do?
A. Configure the Hyperlink control as follows:
View Invoice
B. Handle the Click event of the Hyperlink control. Add the following code to the event handler:
Uri invoiceUri = new Uri("Invoice.xaml#100");
NavigationService service = NavigationService.GetNavigationService(this);
service.Navigate(invoiceUri);
C. Handle the Click event of the Hyperlink control. Add the following code to the event handler:
Invoice invoicePage = new Invoice(100);
this.NavigationService.Navigate(invoicePage);
D. Configure the Hyperlink control as follows:
View Invoice
Answer:
C
Tutorial:
You should handle the Click event of the Hyperlink control and add the following code to the event handler:
Invoice invoicePage = new Invoice(100);
this.NavigationService.Navigate(invoicePage);
This code first creates an instance of the Invoice class, passing the value 100 to the constructor. Next it accesses the current page’s NavigationService instance. Finally, it calls the Navigate method of that instance, passing to it the instance of the page to display. When a page contains a non-default constructor, you must use the NavigationService class to navigate to that page.
You should not configure the Hyperlink control as follows:
View Invoice
This XAML causes the Hyperlink control to initiate navigation to a XAML element that has the XAML-defined name 100 on the Invoice.xaml page.
You should not use the following code:
Uri invoiceUri = new Uri("Invoice.xaml#100");
NavigationService service = NavigationService.GetNavigationService(this);
service.Navigate(invoiceUri);
This code creates a uniform resource identifier (URI) that points to a XAML element that has the XAML-defined name 100 on the Invoice.xaml page. The GetNavigationService method of the NavigationService class allows you to retrieve a specific NavigationService instance. However, passing the current page instance to this method is equivalent to accessing the page’s NavigationService property.
You should not configure the Hyperlink control as follows:
View Invoice
This XAML uses the query string syntax as the value of the NavigateUri property. This syntax does not work for XAML pages.
References:
Navigation Overview, MSDN,
http://msdn2.microsoft.com/en-us/library/ms750478.aspx
How to: Navigate to a Page, MSDN, http://msdn2.microsoft.com/en-us/library/ms743613.aspx
Objective: Building user interfaces.
Sub-objective: Create user and custom controls.
Single answer, multiple-choice
You are developing a WPF custom control. The control must contain a MediaElement property named Media that supports WPF data binding and animation. You need to define the class that represents the control. Which code segment should you use?
A. public class MediaPlayer : System.Windows.Controls.Control
{
public static readonly DependencyProperty MediaProperty = DependencyProperty.Register("Media", typeof(MediaElement), typeof(MediaPlayer));
public MediaElement Media
{
get { return (MediaElement)GetValue(MediaProperty); }
set { SetValue(MediaProperty, value); }
}
}
B. public class MediaPlayer : System.Windows.Controls.Control
{
public static readonly DependencyProperty MediaProperty = DependencyProperty.Register("Media", typeof(MediaElement), typeof(MediaPlayer));
private MediaElement mediaElement;




