Click here to Skip to main content
12,243,192 members (20,872 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# WPF Oracle VS2012
how to set wpf datagrid rendering fast for large data? help with me.

Search button click event
private void Search_Click(object sender, RoutedEventArgs e)
{
try
{
 
dgMMSize.ItemsSource = _mmsize.GetMMSize(txtId.Text);
}
catch (Exception ex)
{
if (stack.ToLower() == "true")
logService.Error(ex.ToString());
else
logService.Error(ex.Message.ToString());
 
MessageBox.Show(ex.Message);
}
}

Search click takes 16 sec before any data is showing.
Posted 13-Aug-14 21:44pm
Edited 14-Aug-14 3:40am
Kim Togo26.9K
v2
Comments
Kim Togo 14-Aug-14 2:52am
   
How much data, 1000, 10.000, 1.000.000 items?
Are you doing any WPF styling or are you using Grouping for the DataGrid?
sureshsankar 14-Aug-14 5:06am
   
any example code?
Kim Togo 14-Aug-14 5:10am
   
Show the WPF XAML where you put in the ItemSource and the layout for your WPF DataGrid.
Kim Togo 14-Aug-14 5:11am
   
Just hit "Improve question" and update with example code
sureshsankar 14-Aug-14 8:28am
   
Search button click event

private void Search_Click(object sender, RoutedEventArgs e)
{
try
{

dgMMSize.ItemsSource = _mmsize.GetMMSize(txtId.Text);
}
catch (Exception ex)
{
if (stack.ToLower() == "true")
logService.Error(ex.ToString());
else
logService.Error(ex.Message.ToString());

MessageBox.Show(ex.Message);
}
}
sureshsankar 14-Aug-14 8:31am
   
if click search button after 16 sec came for data
Kim Togo 14-Aug-14 8:36am
   
Normal in WPF, you only set ItemsSource one time and uses Filter functions to tell what data DataGrid has to show.
My guess is that "_mmsize.GetMMSize" is doing a SQL search and returns an array or list of data ?
   
This is not a good question. The problem is: WPF rendering per se is really fast. It means that you probably designed something in way which gives you a performance problem. But how can we know how did you run into this problem, how do you bind, populate data, etc?
—SA

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

How long time does it take to get data in "_mmsize.GetMMSize(txtId.Text)" ?

Change you code to:
System.Diagnostics.Stopwatch t1 = System.Diagnostics.Stopwatch.StartNew();
var data = _mmsize.GetMMSize(txtId.Text);
t1.Stop();
MessageBox.Show(t1.Elapsed);
 
t1.Restart();
dgMMSize.ItemsSource = data;
 
t1.Stop();
MessageBox.Show(t1.Elapsed);

Perhaps it is a search in SQL ?

Normal in WPF, you only set ItemsSource one time and uses Filter functions to tell what data DataGrid has to show.

My guess is that "_mmsize.GetMMSize" is doing a SQL search and returns an array or list of data ?
  Permalink  
v2
Comments
sureshsankar 14-Aug-14 9:55am
   
list
sureshsankar 14-Aug-14 10:01am
   
i am used list of data
sureshsankar 14-Aug-14 10:21am
   
how set fast load in datagrid
Kim Togo 15-Aug-14 3:02am
   
How long does it takes to get all the data in "_mmsize.GetMMSize(txtId.Text);" ?
sureshsankar 16-Aug-14 1:44am
   
more then 15 sec
Kim Togo 16-Aug-14 3:58am
   
Then the problem is not WPF DataGrid, but the problem is in GetMMSize that takes along time to get all the data.
sureshsankar 16-Aug-14 5:46am
   
normal window datagrid rendering is fast, but am using MDI child window datagrid is very slow.How to fix.
Kim Togo 16-Aug-14 6:32am
   
If getting data in "_mmsize.GetMMSize(txtId.Text);" takes 15 sec., then the problem is in "_mmsize.GetMMSize(txtId.Text);" not the DataGrid?
sureshsankar 16-Aug-14 9:20am
   
i am using MVVM LIGHT 4.5
Kim Togo 16-Aug-14 13:52pm
   
? Okay. If getting data in "_mmsize.GetMMSize(txtId.Text);" takes 15 sec., then the problem is in "_mmsize.GetMMSize(txtId.Text);" not the DataGrid?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 14 Aug 2014
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100