PrepAway - Latest Free Exam Questions & Answers

Category: 70-506

Exam 70-506: TS: Silverlight 4, Development

What should you do?

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4. You add a class named CreateOrderCommand in the application. You implement the ICommand interface in the CreateOrderCommand class. You also create a class named CreateOrderVie wModel. You add the following XAML fragment to create a UserControl named CreateOrder. (Line numbers are included for reference only.)
01 <UserControl.Resources>
02 <local:CreateOrderViewModel x:Key=”vm” />
03 </UserControl.Resources>
04
05 <Grid x:Name=”LayoutRoot” DataContext=”{StaticResource vm}” >
06
07 </Grid>
You need to bind the CreateOrderCommand command to a Button control. What should you do?

Which code segment should you insert at line 11?

You are developing an outofbrowser application by using Silverlight 4. The application contains the following code segment. (Line numbers are included for reference only.)

01 public partial class App : Application
02 {
03 public App()
04 {
05 this.Startup += this.Application_Startup;
06 InitializeComponent();
07 }
08 void Application_Startup(object sender, StartupEventArgs e)
09 {
10 this.RootVisual = new MainPage();
11
12 }
13 }

You need to ensure that when a new version of the application is available, it is automatically installed and the user is notified.
Which code segment should you insert at line 11?

Which code segment should you use?

You are developing a Silverlight 4 application. The Web page of the application contains a Text Box that has the txtTime ID. You define the following JavaScript function on the Web page.
function ShowTime(strTime) {
document.getElementById(‘txtTime’).value = strTime;
}
You need to pass the current time to the ShowTime function from Silverlight. Which code segment should you use?

Which code segment should you insert at lines 11 and 12?

You are developing a ticketing application by using Silverlight 4.
You have a listbox named lstTickets that contains a list of the tickets. The page contains a button that allows the user to print the tickets. The PrintView UserControl binds to the type in lstTickets and is designed to fit a standard sheet of paper. You add the following code segment to the button event handler. (Line numbers are included for reference only.)

01 var doc = new PrintDocument();
02 var view = new PrintView();
03 doc.PrintPage += (s, args) =>
04 {
05 var ppc = doc.PrintedPageCount;
06 if (ppc < lstTickets.Items.Count)
07 {
08 var data = lstTickets.Items[ppc];
09 view.DataContext = data;
10 args.PageVisual = view;
11
12
13 }
14 };
15 doc.Print(“tickets”);

You need to use the Silverlight printing API to print each ticket on its own page. You also need to ensure that all tickets in the listbox are printed.
Which code segment should you insert at lines 11 and 12?

Which code segment you add at line 03?

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4.
You add the following code segment. (Line numbers are included for reference only.)

01 public class MyControl : Control
02 {
03
04 public string Title
05 {
06 get { return (string)GetValue(TitleProperty); }
07 set { SetValue(TitleProperty, value); }
08 }
09 }

You need to create a dependency property named TitleProperty that allows developers to set the Title. You also need to ensure that the default value of the TitleProperty
dependency property is set to Untitled. Which code segment you add at line 03?

Which code segment should you add at line 03?

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4. You create a new user control in the application. You add the following XAML fragment
to the control:

<StackPanel KeyDown=”App_KeyDown” Orientation=”Vertical”>
<TextBox x:Name=”firstName” />
<TextBox x:Name=”lastName” />
<TextBox x:Name=”address” />
</StackPanel>

You add the following code segment in the code behind file of the control. (Line numbers are included for reference only.)

01 private void App_KeyDown(object sender, KeyEventArgs e)
02 {
03
04 }
05
06 private void FirstAndLastNameKeyDown()
07 {
08 …
09 }

You need to ensure that the First And LastName KeyDown method is invoked when a key is pressed while the focus is on the firstName or lastName TextBox controls. You also need to ensure that the default behavior of the controls remains unchanged.
Which code segment should you add at line 03?


Page 1 of 1012345...10...Last »