Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Data Virtualization in MVVM pattern
    primarykey
    data
    text
    <p>, i want to know how can i implement data virtualzation in mvvm pattern ? i have searched but i didnt find data virtualzation using mvvm pattern.</p> <p>this link descripes data virtualzation very good but not in mvvm.</p> <p><a href="http://www.codeproject.com/Articles/34405/WPF-Data-Virtualization" rel="nofollow">http://www.codeproject.com/Articles/34405/WPF-Data-Virtualization</a></p> <p>so please provide a link or example..</p> <pre><code>using System; using System.Collections.Generic; using System.Windows; using System.Windows.Threading; namespace DataVirtualization { /// &lt;summary&gt; /// Interaction logic for DemoWindow.xaml /// &lt;/summary&gt; public partial class DemoWindow { /// &lt;summary&gt; /// Initializes a new instance of the &lt;see cref="DemoWindow"/&gt; class. /// &lt;/summary&gt; public DemoWindow() { InitializeComponent(); // use a timer to periodically update the memory usage DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 1); timer.Tick += timer_Tick; timer.Start(); } private void timer_Tick(object sender, EventArgs e) { tbMemory.Text = string.Format("{0:0.00} MB", GC.GetTotalMemory(true)/1024.0/1024.0); } private void Button_Click(object sender, RoutedEventArgs e) { // create the demo items provider according to specified parameters int numItems = int.Parse(tbNumItems.Text); int fetchDelay = int.Parse(tbFetchDelay.Text); DemoCustomerProvider customerProvider = new DemoCustomerProvider(numItems, fetchDelay); // create the collection according to specified parameters int pageSize = int.Parse(tbPageSize.Text); int pageTimeout = int.Parse(tbPageTimeout.Text); if ( rbNormal.IsChecked.Value ) { DataContext = new List&lt;Customer&gt;(customerProvider.FetchRange(0, customerProvider.FetchCount())); } else if ( rbVirtualizing.IsChecked.Value ) { DataContext = new VirtualizingCollection&lt;Customer&gt;(customerProvider, pageSize); } else if ( rbAsync.IsChecked.Value ) { DataContext = new AsyncVirtualizingCollection&lt;Customer&gt;(customerProvider, pageSize, pageTimeout*1000); } } } </code></pre> <p>}</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    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. COJust retrieve the first N items from your datasource and then keep and index of the "current position". What have you tried? BTW that code is horrible. the person who wrote it has no idea about WPF and is trying to use it like winforms. big fail.
      singulars
    2. COThanks for ur comment ,i am asking about how can i implement Data virtualization using MVVM ,i have tried to do paging with the tradational way in mvvm 2 buttons (prev,Next) binded to commands and setting page size and using paging in my linq, but i need to get rid of these buttons by using data virtualzation where user feel that he gets all data. i know that it is horrible but this is what i found if you have better please provide.
      singulars
    3. COI'm not sure that I fully understand your question because `Virtualization` is performed in UI controls and has nothing to do with view models. Perhaps you are talking about paging? Having implemented some animated virtualization controls before, I can tell you that this is not for the feint hearted... it is pretty complicated stuff. However, if you are determined to follow this path, then I would advise you to read through chapter 8 of the WPF Control Development Unleashed book which has an excellent description and example of doing this. I managed to find an [online copy](http://www.adorkabl
      singulars
 

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