using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
namespace PLinqDataSource {
public class PLinqViewModel{
public PLinqViewModel() {
ListSource = new OrderDataListSource(1000000);
}
public virtual OrderDataListSource ListSource { get; set; }
}
public class OrderDataListSource : IListSource {
List<OrderData> orders;
int count = 0;
static object Locker = new object();
public OrderDataListSource(int count) {
this.count = count;
}
void GenerateOrders() {
orders = new List<OrderData>(count);
Random rnd = new Random();
int customersCount = Data.Customers.Count;
int productsCount = Data.Products.Count;
for(int i = 0; i < count; i++) {
OrderData orderData = new OrderData();
orderData.OrderId = i + 1;
orderData.CustomerName = Data.Customers[rnd.Next(customersCount)];
orderData.OrderDate = DateTime.Today.Subtract(TimeSpan.FromDays(rnd.Next(180)));
KeyValuePair<string, decimal> product = Data.Products[rnd.Next(productsCount)];
orderData.ProductName = product.Key;
orderData.Price = product.Value;
orderData.Quantity = rnd.Next(200) + 1;
orders.Add(orderData);
}
}
public IList GetList() {
if(orders == null) {
lock(Locker) {
if(orders == null) {
GenerateOrders();
}
}
}
return orders;
}
public bool ContainsListCollection {
get { return false; }
}
}
public class OrderData {
public int OrderId { get; set; }
public string CustomerName { get; set; }
public DateTime OrderDate { get; set; }
public string ProductName { get; set; }
public decimal Price { get; set; }
public int Quantity { get; set; }
}
}
using System;
using System.Collections.Generic;
namespace PLinqDataSource {
public static class Data {
static List<string> customers;
public static List<string> Customers {
get {
if(customers == null) {
customers = new List<string>();
customers.AddRange(new string[] { "Maria Anders", "Ana Trujillo", "Antonio Moreno", "Thomas Hardy",
"Christina Berglund", "Hanna Moos", "Frédérique Citeaux", "Martín Sommer", "Laurence Lebihan", "Elizabeth Lincoln",
"Victoria Ashworth", "Patricio Simpson", "Francisco Chang", "Yang Wang", "Pedro Afonso", "Elizabeth Brown", "Sven Ottlieb",
"Janine Labrune", "Ann Devon", "Roland Mendel", "Aria Cruz", "Diego Roel", "Martine Rancé", "Maria Larsson", "Peter Franken",
"Carine Schmitt", "Paolo Accorti", "Lino Rodriguez ", "Eduardo Saavedra", "José Pedro Freyre", "André Fonseca", "Howard Snyder",
"Manuel Pereira", "Mario Pontes", "Carlos Hernández", "Yoshi Latimer", "Patricia McKenna", "Helen Bennett", "Philip Cramer",
"Daniel Tonini", "Annette Roulet", "Yoshi Tannamuri", "John Steel", "Renate Messner", "Jaime Yorres", "Carlos González",
"Felipe Izquierdo", "Fran Wilson", "Giovanni Rovelli", "Catherine Dewey", "Jean Fresnière", "Alexander Feuer", "Simon Crowther",
"Yvonne Moncada", "Rene Phillips", "Henriette Pfalzheim", "Marie Bertrand", "Guillermo Fernández", "Georg Pipps", "Isabel de Castro",
"Bernardo Batista", "Lúcia Carvalho", "Horst Kloss", "Sergio Gutiérrez", "Paula Wilson", "Maurizio Moroni", "Janete Limeira",
"Michael Holz", "Alejandra Camino", "Jonas Bergulfsen", "Jose Pavarotti", "Hari Kumar", "Jytte Petersen", "Dominique Perrier",
"Art Braunschweiger", "Pascale Cartrain", "Liz Nixon", "Liu Wong", "Karin Josephs", "Miguel Angel Paolino", "Anabela Domingues",
"Helvetius Nagy", "Palle Ibsen", "Mary Saveley", "Paul Henriot", "Rita Müller", "Pirkko Koskitalo", "Paula Parente", "Karl Jablonski",
"Matti Karttunen", "Zbyszek Piestrzeniewicz" });
}
return customers;
}
}
static List<KeyValuePair<string, decimal>> products;
public static List<KeyValuePair<string, decimal>> Products {
get {
if(products == null) {
products = new List<KeyValuePair<string, decimal>>();
products.Add(new KeyValuePair<string,decimal>("Chai", 18.0m));
products.Add(new KeyValuePair<string,decimal>("Chang", 19.0m));
products.Add(new KeyValuePair<string,decimal>("Aniseed Syrup", 10.0m));
products.Add(new KeyValuePair<string,decimal>("Chef Anton's Cajun Seasoning", 22.0m));
products.Add(new KeyValuePair<string,decimal>("Chef Anton's Gumbo Mix", 21.35m));
products.Add(new KeyValuePair<string,decimal>("Grandma's Boysenberry Spread", 25.0m));
products.Add(new KeyValuePair<string,decimal>("Uncle Bob's Organic Dried Pears", 30.0m));
products.Add(new KeyValuePair<string,decimal>("Northwoods Cranberry Sauce", 40.0m));
products.Add(new KeyValuePair<string,decimal>("Mishi Kobe Niku", 97.0m));
products.Add(new KeyValuePair<string,decimal>("Ikura", 31.0m));
products.Add(new KeyValuePair<string,decimal>("Queso Cabrales", 21.0m));
products.Add(new KeyValuePair<string,decimal>("Queso Manchego La Pastora", 38.0m));
products.Add(new KeyValuePair<string,decimal>("Konbu", 6.0m));
products.Add(new KeyValuePair<string,decimal>("Tofu", 23.25m));
products.Add(new KeyValuePair<string,decimal>("Genen Shouyu", 15.5m));
products.Add(new KeyValuePair<string,decimal>("Pavlova", 17.45m));
products.Add(new KeyValuePair<string,decimal>("Alice Mutton", 39.0m));
products.Add(new KeyValuePair<string,decimal>("Carnarvon Tigers", 62.5m));
products.Add(new KeyValuePair<string,decimal>("Teatime Chocolate Biscuits", 9.2m));
products.Add(new KeyValuePair<string,decimal>("Sir Rodney's Marmalade", 81.0m));
products.Add(new KeyValuePair<string,decimal>("Sir Rodney's Scones", 10.0m));
products.Add(new KeyValuePair<string,decimal>("Gustaf's Knäckebröd", 21.0m));
products.Add(new KeyValuePair<string,decimal>("Tunnbröd", 9.0m));
products.Add(new KeyValuePair<string,decimal>("Guaraná Fantástica", 4.5m));
products.Add(new KeyValuePair<string,decimal>("NuNuCa Nuß-Nougat-Creme", 14.0m));
products.Add(new KeyValuePair<string,decimal>("Gumbär Gummibärchen", 31.23m));
products.Add(new KeyValuePair<string,decimal>("Schoggi Schokolade", 43.9m));
products.Add(new KeyValuePair<string,decimal>("Rössle Sauerkraut", 45.6m));
products.Add(new KeyValuePair<string,decimal>("Thüringer Rostbratwurst", 123.79m));
products.Add(new KeyValuePair<string,decimal>("Nord-Ost Matjeshering", 25.89m));
products.Add(new KeyValuePair<string,decimal>("Gorgonzola Telino", 12.5m));
products.Add(new KeyValuePair<string,decimal>("Mascarpone Fabioli", 32.0m));
products.Add(new KeyValuePair<string,decimal>("Geitost", 2.5m));
products.Add(new KeyValuePair<string,decimal>("Sasquatch Ale", 14.0m));
products.Add(new KeyValuePair<string,decimal>("Steeleye Stout", 18.0m));
products.Add(new KeyValuePair<string,decimal>("Inlagd Sill", 19.0m));
products.Add(new KeyValuePair<string,decimal>("Gravad lax", 26.0m));
products.Add(new KeyValuePair<string,decimal>("Côte de Blaye", 263.5m));
products.Add(new KeyValuePair<string,decimal>("Chartreuse verte", 18.0m));
products.Add(new KeyValuePair<string,decimal>("Boston Crab Meat", 18.4m));
products.Add(new KeyValuePair<string,decimal>("Jack's New England Clam Chowder", 9.65m));
products.Add(new KeyValuePair<string,decimal>("Singaporean Hokkien Fried Mee", 14.0m));
products.Add(new KeyValuePair<string,decimal>("Ipoh Coffee", 46.0m));
products.Add(new KeyValuePair<string,decimal>("Gula Malacca", 19.45m));
products.Add(new KeyValuePair<string,decimal>("Røgede sild", 9.5m));
products.Add(new KeyValuePair<string,decimal>("Spegesild", 12.0m));
products.Add(new KeyValuePair<string,decimal>("Zaanse koeken", 9.5m));
products.Add(new KeyValuePair<string,decimal>("Chocolade", 12.75m));
products.Add(new KeyValuePair<string,decimal>("Maxilaku", 20.0m));
products.Add(new KeyValuePair<string,decimal>("Valkoinen suklaa", 16.25m));
products.Add(new KeyValuePair<string,decimal>("Manjimup Dried Apples", 53.0m));
products.Add(new KeyValuePair<string,decimal>("Filo Mix", 7.0m));
products.Add(new KeyValuePair<string,decimal>("Perth Pasties", 32.8m));
products.Add(new KeyValuePair<string,decimal>("Tourtière", 7.45m));
products.Add(new KeyValuePair<string,decimal>("Pâté chinois", 24.0m));
products.Add(new KeyValuePair<string,decimal>("Gnocchi di nonna Alice", 38.0m));
products.Add(new KeyValuePair<string,decimal>("Ravioli Angelo", 19.5m));
products.Add(new KeyValuePair<string,decimal>("Escargots de Bourgogne", 13.25m));
products.Add(new KeyValuePair<string,decimal>("Raclette Courdavault", 55.0m));
products.Add(new KeyValuePair<string,decimal>("Camembert Pierrot", 34.0m));
products.Add(new KeyValuePair<string,decimal>("Sirop d'érable", 28.5m));
products.Add(new KeyValuePair<string,decimal>("Tarte au sucre", 49.3m));
products.Add(new KeyValuePair<string,decimal>("Vegie-spread", 43.9m));
products.Add(new KeyValuePair<string,decimal>("Wimmers gute Semmelknödel", 33.25m));
products.Add(new KeyValuePair<string,decimal>("Louisiana Fiery Hot Pepper Sauce", 21.05m));
products.Add(new KeyValuePair<string,decimal>("Louisiana Hot Spiced Okra", 17.0m));
products.Add(new KeyValuePair<string,decimal>("Laughing Lumberjack Lager", 14.0m));
products.Add(new KeyValuePair<string,decimal>("Scottish Longbreads", 12.5m));
products.Add(new KeyValuePair<string,decimal>("Gudbrandsdalsost", 36.0m));
products.Add(new KeyValuePair<string,decimal>("Outback Lager", 15.0m));
products.Add(new KeyValuePair<string,decimal>("Fløtemysost", 21.5m));
products.Add(new KeyValuePair<string,decimal>("Mozzarella di Giovanni", 34.8m));
products.Add(new KeyValuePair<string,decimal>("Röd Kaviar", 15.0m));
products.Add(new KeyValuePair<string,decimal>("Longlife Tofu", 10.0m));
products.Add(new KeyValuePair<string,decimal>("Rhönbräu Klosterbier", 7.75m));
products.Add(new KeyValuePair<string,decimal>("Lakkalikööri", 18.0m));
products.Add(new KeyValuePair<string,decimal>("Original Frankfurter grüne Soße", 13.0m));
}
return products;
}
}
}
}
<Window x:Class="PLinqDataSource.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:PLinqDataSource" DataContext="{dxmvvm:ViewModelSource Type=local:PLinqViewModel}"
Title="MainWindow" Height="800" Width="1000">
<Grid>
<dx:PLinqInstantFeedbackDataSource Name="pLinqInstantDataSource" ListSource="{Binding Path=ListSource}" />
<dxg:GridControl Name="grid" ItemsSource="{Binding ElementName=pLinqInstantDataSource, Path=Data}">
<dxg:GridControl.Columns>
<dxg:GridColumn x:Name="colOrderId" FieldName="OrderId" Header="ID" Width="60" MinWidth="60" AllowColumnFiltering="False" AllowGrouping="False" />
<dxg:GridColumn x:Name="colCustomerName" FieldName="CustomerName" Width="200" />
<dxg:GridColumn x:Name="colOrderDate" FieldName="OrderDate" Width="100" AllowColumnFiltering="False">
<dxg:GridColumn.EditSettings>
<dxe:DateEditSettings DisplayFormat="d" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn x:Name="colProductName" FieldName="ProductName" Width="200" />
<dxg:GridColumn x:Name="colPrice" FieldName="Price" Width="60" />
<dxg:GridColumn x:Name="colQuantity" FieldName="Quantity" Width="60" />
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView AutoWidth="True" ShowTotalSummary="True" WaitIndicatorType="Panel" />
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Closed" Command="{Binding ElementName=pLinqInstantItemsSource, Path=DisposeCommand}" />
</dxmvvm:Interaction.Behaviors>
</Window>
<Application x:Class="PLinqDataSource.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
Imports System
Imports System.Collections.Generic
Namespace PLinqDataSource
Public NotInheritable Class Data
Private Sub New()
End Sub
Private Shared customers_Renamed As List(Of String)
Public Shared ReadOnly Property Customers() As List(Of String)
Get
If customers_Renamed Is Nothing Then
customers_Renamed = New List(Of String)()
customers_Renamed.AddRange(New String() { "Maria Anders", "Ana Trujillo", "Antonio Moreno", "Thomas Hardy", "Christina Berglund", "Hanna Moos", "Frédérique Citeaux", "Martín Sommer", "Laurence Lebihan", "Elizabeth Lincoln", "Victoria Ashworth", "Patricio Simpson", "Francisco Chang", "Yang Wang", "Pedro Afonso", "Elizabeth Brown", "Sven Ottlieb", "Janine Labrune", "Ann Devon", "Roland Mendel", "Aria Cruz", "Diego Roel", "Martine Rancé", "Maria Larsson", "Peter Franken", "Carine Schmitt", "Paolo Accorti", "Lino Rodriguez ", "Eduardo Saavedra", "José Pedro Freyre", "André Fonseca", "Howard Snyder", "Manuel Pereira", "Mario Pontes", "Carlos Hernández", "Yoshi Latimer", "Patricia McKenna", "Helen Bennett", "Philip Cramer", "Daniel Tonini", "Annette Roulet", "Yoshi Tannamuri", "John Steel", "Renate Messner", "Jaime Yorres", "Carlos González", "Felipe Izquierdo", "Fran Wilson", "Giovanni Rovelli", "Catherine Dewey", "Jean Fresnière", "Alexander Feuer", "Simon Crowther", "Yvonne Moncada", "Rene Phillips", "Henriette Pfalzheim", "Marie Bertrand", "Guillermo Fernández", "Georg Pipps", "Isabel de Castro", "Bernardo Batista", "Lúcia Carvalho", "Horst Kloss", "Sergio Gutiérrez", "Paula Wilson", "Maurizio Moroni", "Janete Limeira", "Michael Holz", "Alejandra Camino", "Jonas Bergulfsen", "Jose Pavarotti", "Hari Kumar", "Jytte Petersen", "Dominique Perrier", "Art Braunschweiger", "Pascale Cartrain", "Liz Nixon", "Liu Wong", "Karin Josephs", "Miguel Angel Paolino", "Anabela Domingues", "Helvetius Nagy", "Palle Ibsen", "Mary Saveley", "Paul Henriot", "Rita Müller", "Pirkko Koskitalo", "Paula Parente", "Karl Jablonski", "Matti Karttunen", "Zbyszek Piestrzeniewicz" })
End If
Return customers_Renamed
End Get
End Property
Private Shared products_Renamed As List(Of KeyValuePair(Of String, Decimal))
Public Shared ReadOnly Property Products() As List(Of KeyValuePair(Of String, Decimal))
Get
If products_Renamed Is Nothing Then
products_Renamed = New List(Of KeyValuePair(Of String, Decimal))()
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Chai", 18.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Chang", 19.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Aniseed Syrup", 10.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Chef Anton's Cajun Seasoning", 22.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Chef Anton's Gumbo Mix", 21.35D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Grandma's Boysenberry Spread", 25.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Uncle Bob's Organic Dried Pears", 30.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Northwoods Cranberry Sauce", 40.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Mishi Kobe Niku", 97.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Ikura", 31.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Queso Cabrales", 21.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Queso Manchego La Pastora", 38.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Konbu", 6.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Tofu", 23.25D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Genen Shouyu", 15.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Pavlova", 17.45D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Alice Mutton", 39.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Carnarvon Tigers", 62.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Teatime Chocolate Biscuits", 9.2D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Sir Rodney's Marmalade", 81.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Sir Rodney's Scones", 10.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Gustaf's Knäckebröd", 21.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Tunnbröd", 9.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Guaraná Fantástica", 4.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("NuNuCa Nuß-Nougat-Creme", 14.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Gumbär Gummibärchen", 31.23D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Schoggi Schokolade", 43.9D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Rössle Sauerkraut", 45.6D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Thüringer Rostbratwurst", 123.79D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Nord-Ost Matjeshering", 25.89D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Gorgonzola Telino", 12.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Mascarpone Fabioli", 32.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Geitost", 2.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Sasquatch Ale", 14.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Steeleye Stout", 18.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Inlagd Sill", 19.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Gravad lax", 26.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Côte de Blaye", 263.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Chartreuse verte", 18.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Boston Crab Meat", 18.4D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Jack's New England Clam Chowder", 9.65D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Singaporean Hokkien Fried Mee", 14.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Ipoh Coffee", 46.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Gula Malacca", 19.45D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Røgede sild", 9.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Spegesild", 12.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Zaanse koeken", 9.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Chocolade", 12.75D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Maxilaku", 20.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Valkoinen suklaa", 16.25D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Manjimup Dried Apples", 53.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Filo Mix", 7.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Perth Pasties", 32.8D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Tourtière", 7.45D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Pâté chinois", 24.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Gnocchi di nonna Alice", 38.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Ravioli Angelo", 19.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Escargots de Bourgogne", 13.25D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Raclette Courdavault", 55.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Camembert Pierrot", 34.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Sirop d'érable", 28.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Tarte au sucre", 49.3D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Vegie-spread", 43.9D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Wimmers gute Semmelknödel", 33.25D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Louisiana Fiery Hot Pepper Sauce", 21.05D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Louisiana Hot Spiced Okra", 17.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Laughing Lumberjack Lager", 14.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Scottish Longbreads", 12.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Gudbrandsdalsost", 36.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Outback Lager", 15.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Fløtemysost", 21.5D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Mozzarella di Giovanni", 34.8D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Röd Kaviar", 15.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Longlife Tofu", 10.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Rhönbräu Klosterbier", 7.75D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Lakkalikööri", 18.0D))
products_Renamed.Add(New KeyValuePair(Of String,Decimal)("Original Frankfurter grüne Soße", 13.0D))
End If
Return products_Renamed
End Get
End Property
End Class
End Namespace
' Developer Express Code Central Example:
' How to parallelize data-intensive operations on in-memory data in Instant Feedback UI mode
'
' In this demo, the DevExpress Grid Control for WPF operates in Instant Feedback
' data binding mode on in-memory data. All operations on data (e.g. sorting,
' groping, filtering, summary calculation, etc.) are performed asynchronously and
' parallelized on multiple processors. This allows the computing power of your
' hardware to be utilized to the full extent without UI freezing.
' See also:
' WPF
' Data Grid Control – PLINQ Data Support
' (http://community.devexpress.com/blogs/theprogressbar/archive/2011/08/22/wpf-data-grid-control-plinq-data-support.aspx)
' Binding
' to In-Memory Data Using PLINQ
' (http://documentation.devexpress.com/#WPF/CustomDocument10472)
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E3382
Imports System
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Imports System.Linq
Imports System.Windows
Namespace PLinqDataSource
''' <summary>
''' Interaction logic for App.xaml
''' </summary>
Partial Public Class App
Inherits Application
End Class
End Namespace
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Namespace PLinqDataSource
Public Class PLinqViewModel
Public Sub New()
ListSource = New OrderDataListSource(1000000)
End Sub
Public Overridable Property ListSource() As OrderDataListSource
End Class
Public Class OrderDataListSource
Implements IListSource
Private orders As List(Of OrderData)
Private count As Integer = 0
Private Shared Locker As New Object()
Public Sub New(ByVal count As Integer)
Me.count = count
End Sub
Private Sub GenerateOrders()
orders = New List(Of OrderData)(count)
Dim rnd As New Random()
Dim customersCount As Integer = Data.Customers.Count
Dim productsCount As Integer = Data.Products.Count
For i As Integer = 0 To count - 1
Dim orderData As New OrderData()
orderData.OrderId = i + 1
orderData.CustomerName = Data.Customers(rnd.Next(customersCount))
orderData.OrderDate = Date.Today.Subtract(TimeSpan.FromDays(rnd.Next(180)))
Dim product As KeyValuePair(Of String, Decimal) = Data.Products(rnd.Next(productsCount))
orderData.ProductName = product.Key
orderData.Price = product.Value
orderData.Quantity = rnd.Next(200) + 1
orders.Add(orderData)
Next i
End Sub
Public Function GetList() As IList Implements IListSource.GetList
If orders Is Nothing Then
SyncLock Locker
If orders Is Nothing Then
GenerateOrders()
End If
End SyncLock
End If
Return orders
End Function
Public ReadOnly Property ContainsListCollection() As Boolean Implements IListSource.ContainsListCollection
Get
Return False
End Get
End Property
End Class
Public Class OrderData
Public Property OrderId() As Integer
Public Property CustomerName() As String
Public Property OrderDate() As Date
Public Property ProductName() As String
Public Property Price() As Decimal
Public Property Quantity() As Integer
End Class
End Namespace