Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Data Virtualization in MVVM pattern
    text
    copied!<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>
 

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