PrepAway - Latest Free Exam Questions & Answers

What should you do ?

You are developing a Windows Presentation Foundation (WPF) application that displays opportunities from List<T.. class named Lead. The Lead class contains the properties Title and Revenue.

You add a DataGrid control named dgQualifiedLeads to the MainWindow.xaml file. You set the ItemsSource property to Leads as follows.

ICollectionView Leads;
public MainWindow()
{
IntializeComponent();
Leads = CollectionViewSource.GetDefaultView(
new List<Lead>(
new Lead[]
{
new Lead() { Title = “Title1″, Revenue=”1234.33”},
new Lead() { Title = “Title2″, Revenue=”1234.33”},
new Lead() { Title = “Title3″, Revenue=”1234.33”},
new Lead() { Title = “Title4″, Revenue=”1234.33”},
new Lead() { Title = “Title5″, Revenue=”1234.33”}
}
));

dgQualifiedLeads.ItemsSource = Leads;
}

You need to ensure that CollectionViewSource is used to filter the list to display only Lead objects with revenue …

What should you do ?

PrepAway - Latest Free Exam Questions & Answers

A.
Insert the following code at Line 18
Leads.Filter = new Predicate<object>(FilterOut);
Add the following code segment to the code-behind of the MainWindow.xaml file.
public bool FilterOut(object item)
{
Lead lead = item as Lead;
return (lead.Revenue < 1000d) ? true : false;
}

B.
Insert the following code at Line 18
Leads.Filter = new Predicate<object>(FilterOut);
Add the following code segment to the code-behind of the MainWindow.xaml file.
public bool FilterOut(object item)
{
Lead lead = item as Lead;
return (lead.Revenue > 1000d) ? false : true;
}

C.
Insert the following code at Line 18
Leads.Filter = new Predicate<object>((s) => { ((Lead) s).Revenue > 1000d });

D.
Insert the following code at Line 18
Leads.SortDescriptions.Add(new SortDescription(“Revenue”, ListSortDirection.Ascending));

One Comment on “What should you do ?

  1. Mr ijs says:

    Full question text:

    You are developing a Windows Presentation Foundation (WPF) application that displays opportunities from List named Leads, where Tis a class named Lead.
    The Lead class contains the properties Title and Revenue.
    You add a DataGrid control named dgQualifiedLeads to the MainWindow.xaml file. You set the ItemSource property of dgQualifiedLeads to Leads as follows.
    (Line numbers are included for reference only)

    01 ICollectionView Leads;
    02 public MainUindow()
    03 {
    04 InitializeCoroponent();
    05 Leads = ColleccionViewSource.GetDefaultView(
    06 new List(
    07 new Lead[]
    08 {
    09 new Lead(){Title=”Title1″, Revenue=1250.78d},
    10 new Lead(){Title=”Title2″, Revenue=500.00d},
    11 new Lead(){Title=”Title3″, Revenue=2300.33d},
    12 new Lead(){Title=”Title4″, Revenue=2989.09d},
    13 new Lead(){Title=”Title5″, Revenue=1500.21d},
    14 }
    15 }
    16 } ;
    17 dgQualifiedLeads.ItemsSource = Leads;
    18
    19 }

    You need to ensure that CollectionViewSource is used to filter the list to display only Lead objects with revenue of more than $1,000.
    What should you do?




    0



    0

Leave a Reply