DataBinding in UI Composition Employee Service

Topics: Prism v2 - WPF 3.5
Jan 29, 2009 at 7:52 AM
I'm writing an App like the UI Composition example.
I have 40000 employess, and now when i start the App, i must wait 2 minutes til i see the ListView with the employees.

I changed for testing this in the UI Composition Employee Service:

namespace UIComposition.Modules.Employee.Services
    using System.Collections.ObjectModel;
    using System;

    public class EmployeeService : IEmployeeService
        public ObservableCollection<BusinessEntities.Employee> RetrieveEmployees()
            ObservableCollection<BusinessEntities.Employee> employees = new ObservableCollection<BusinessEntities.Employee>();
            for (int i = 1; i < 40001; i++)
                employees.Add(new BusinessEntities.Employee(1) { FirstName = "John", LastName = "Smith", Phone = "+1 (425) 555-0101", Email = "", Address = "One Microsoft Way", City = "Redmond", State = "WA" });

            return employees;

It's the same as in my Application, i must wait a long time, to see the result, but i think i bind the employee-collection at the employeelistpresenter.
Why i must wait so long and how can i fix this

Jan 29, 2009 at 1:51 PM

Hi Bapaf,


I looked into this and created a blog post, which addresses this specific scenario. I hope you find it useful:

·         How to: Show large amounts of data in WPF using UI Virtualization


Please let me know if this helps.


Damian Schenkelman

Jan 29, 2009 at 4:43 PM
In real case, you won't probably call 40001 records from service. Instead, you will prefer to use server-side paging.

If you are using Xceed Datagrid or other controls that supports lazy-loading, you won't have that problem too.
Jan 30, 2009 at 9:18 AM
Hi Damian,
that was the solution.