Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, your record count is really nothing in front of wpf's ListView as it makes use of the VirtualizingStackPanel.</p> <p>Apart from the exact solution of PropertyChange Notification, you should also consider having a look at the concept of <a href="http://blogs.msdn.com/b/charlie/archive/2007/12/09/deferred-execution.aspx" rel="nofollow noreferrer">deferred execution</a>. You seem to convert everything into a list which would lead to force enumeration of the result set at once. </p> <p>Let us consider your code:</p> <pre><code>_people= GetAll().ToList(); //The result of GetAll is enumerated and a solid list is created List&lt;Person&gt; allPeople = (from person in _people select new PersonViewModel(person)).ToList(); // another list created AllPeople = new ObservableCollection&lt;PersonViewModel&gt;(allPeople); // ObservableCollection created out of list </code></pre> <p>Let us tweak it a bit:</p> <pre><code>_people= GetAll(); // The result is just referred by _people IEnumerable&lt;Person&gt; allPeople = (from person in _people select new PersonViewModel(person)); // IEnumerable is just provided with a query. No other operation is done AllPeople = new ObservableCollection&lt;PersonViewModel&gt;(allPeople); // The ObservableCollection requests element from allPeople // which in turn requests from the query // which in turn requests from _people // which enumerates the result of GetAll() and yields the result. </code></pre> <p>Hence you can avoid the creation of temporary lists.</p> <p>Further, even the <code>GetAll()</code> method could be made to return an IEnumerable if it doesn't.</p> <p>You could take a look at <br> <a href="http://msdn.microsoft.com/en-us/library/system.collections.ienumerable.aspx" rel="nofollow noreferrer">IEnumerable</a> <br> <a href="http://msdn.microsoft.com/en-us/library/system.linq.iqueryable.aspx" rel="nofollow noreferrer">IQueryable</a> <br> <a href="http://msdn.microsoft.com/en-us/library/9k7k7cf0(VS.80).aspx" rel="nofollow noreferrer">yield</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload