PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which XAML fragment should you use?

You are developing a Silverlight 4 application.
You have a collection named ColPeople of the List<Person> type. You define the Person class according to the following code segment.

public class Person
{
public string Name {get; set;}
public string Description { get; set; }
public string Gender { get; set; }
public int Age { get; set; }
public int Weight { get; set; }
}
You need to bind ColPeople to a ComboBox so that only the Name property is displayed.
Which XAML fragment should you use?

Which code segment should you use?

You are developing a shopping application by using Silverlight 4.
The application has a ListBox named lstBasket that contains the items in the shopping basket. You need to save the items in lstBasket to isolated storage. You also need to ensure that the items isolated storage are available to other Silverlight applications hosted on the same Web site.
Which code segment should you use?

Which XAML fragment should you use?

You are developing a Silverlight 4 application.
You have a collection named ColPeople of the List<Person> type. You define the Person class according to the following code segment.

public class Person
{
public string Name {get; set;}
public string Description { get; set; }
public string Gender { get; set; }
public int Age { get; set; }
public int Weight { get; set; }
}
You need to bind ColPeople to a ComboBox so that only the Name property is displayed.
Which XAML fragment should you use?

What should you do?

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4.
You add a BackgroundWorker object named worker to the application. You also add a CheckBox control named checkBox and a TextBlock control named statusTextBlock.
You add the follo wing code segment. (Line numbers are included for reference only.)

01 public MainPage()
02 {
03 InitializeComponent();
04 worker.WorkerReportsProgress = true;
05 worker.DoWork += new DoWorkEventHandler(worker_DoWork);
06 worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
07 }
08 private void worker_DoWork(object sender, DoWorkEventArgs e)
09 {
10 for (int i = 0; i < 100; i++) {
11 bool isChecked = checkBox.IsChecked.HasValue && checkBox.IsChecked.Value;
12 ExecuteLongRunningProcessStep(isChecked);
13 worker.ReportProgress(i);
14 }
15 }
16 private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
17 {
18 statusTextBlock.Text = e.ProgressPercentage + “%”;
19 }

You attempt to run the application. You receive the following error message: “Invalid crossthread access.”
You need to ensure that worker executes successfully. What should you do?