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?

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?

A.
<ComboBox DataContext=”{Binding ColPeople}” ItemsSource=”{Binding ColPeople}” DisplayMemberPath=”Name” />

B.
<ComboBox DataContext=”{Binding Person}” ItemsSource=”{Binding Person}” DisplayMemberPath=”ColPeople” />

C.
<ComboBox DataContext=”{Binding ColPeople}” DisplayMemberPath=”Name” />

D.
<ComboBox DataContext=”{Binding Person}” />



Leave a Reply 0

Your email address will not be published. Required fields are marked *