or
Hi everyone,
I use GridView data binding with 30 million records,
I use "load on demand", but it only works if I load 15 million records, but 30 million records, appeared timed out errors,How to solve this error.
Sorry my english,
below is my code:
var context =
new
NorthwindEntities();
var query = context.Order_Details.OrderBy(o => o.OrderID);
var view =
new
VirtualQueryableCollectionView(query) { LoadSize = 10 };
DataContext = view;
<
Window.DataContext
>
<
local:MainViewModel
/>
</
Window.DataContext
>
<
Window.Resources
>
<
Style
x:Key
=
"DraggableListBoxItem"
TargetType
=
"telerik:RadListBoxItem"
>
<
Setter
Property
=
"telerik:DragDropManager.AllowCapturedDrag"
Value
=
"True"
/>
</
Style
>
</
Window.Resources
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
/>
<
ColumnDefinition
/>
</
Grid.ColumnDefinitions
>
<
telerik:RadListBox
ItemContainerStyle
=
"{StaticResource DraggableListBoxItem}"
AllowDrop
=
"True"
Grid.Column
=
"0"
ItemsSource
=
"{Binding AvailableDropZones}"
DisplayMemberPath
=
"Name"
>
<
telerik:RadListBox.DragDropBehavior
>
<
telerik:ListBoxDragDropBehavior
/>
</
telerik:RadListBox.DragDropBehavior
>
</
telerik:RadListBox
>
<
telerik:RadListBox
ItemsSource
=
"{Binding SelectedDropZones}"
Grid.Column
=
"1"
AllowDrop
=
"True"
DisplayMemberPath
=
"Id"
>
<
telerik:RadListBox.DragDropBehavior
>
<
telerik:ListBoxDragDropBehavior
/>
</
telerik:RadListBox.DragDropBehavior
>
</
telerik:RadListBox
>
</
Grid>
public class MainViewModel :ViewModelBase
{
public MainViewModel()
{
ObservableCollection<Friend> list = new ObservableCollection<Friend>();
list.Add(new Friend() { Id = 1, Name = "Andy" });
list.Add(new Friend() { Id = 2, Name = "Josh" });
list.Add(new Friend() { Id = 3, Name = "Smith" });
list.Add(new Friend() { Id = 4, Name = "Andrew" });
AvailableDropZones = list;
}
ObservableCollection<Friend> availeble;
public ObservableCollection<Friend> AvailableDropZones
{
get
{
return availeble;
}
set
{
if (availeble != value)
{
availeble = value;
OnPropertyChanged("AvailableDropZones");
}
}
}
ObservableCollection<Friend> selected;
public ObservableCollection<Friend> SelectedDropZones
{
get
{
return selected;
}
set
{
if (selected != value)
{
selected = value;
OnPropertyChanged("SelectedDropZones");
}
}
}
}
public class Friend
{
public int Id { get; set; }
public string Name { get; set; }
}
private
void
TreeNodeExpanded(
object
sender, RoutedEventArgs e)
{
TreeViewItem tvi = e.OriginalSource
as
TreeViewItem;
if
(tvi !=
null
)
{
if
(tvi.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
{
EventHandler itemsGenerated =
null
;
itemsGenerated =
delegate
(
object
s, EventArgs args)
{
if
((s
as
ItemContainerGenerator).Status == GeneratorStatus.ContainersGenerated)
{
(s
as
ItemContainerGenerator).StatusChanged -= itemsGenerated;
tvi.Dispatcher.BeginInvoke(DispatcherPriority.DataBind,
(ThreadStart)
delegate
{
Mouse.OverrideCursor =
null
;
});
}
};
tvi.ItemContainerGenerator.StatusChanged += itemsGenerated;
Mouse.OverrideCursor = Cursors.Wait;
}
}
}