This is a migrated thread and some comments may be shown as answers.

[Solved] Gridview performance problems

1 Answer 135 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hector
Top achievements
Rank 1
Hector asked on 02 Oct 2009, 07:48 PM
All of a sudden, my Gridview began having data loading performance issues, in a big way.  It was working fine, but I am not sure what it is I did that caused this behavior to happen.  I am using a NetRIA service to load my data, and the data is retrieved pretty fast, but for some reason, it is taking the GridView an extremely long time to load it.  It also take very long time to do a SelectAll on it.  Can anyone help me trouble shoot my app?  I am not sure what I a have done to break it.  Here is a snipet of code of where I am laoding the data:

    public partial class GridViewTest : UserControl  
    {  
        public GridViewTest()  
        {  
            InitializeComponent();  
            this.Loaded += new RoutedEventHandler(GridViewTest_Loaded);  
        }  
 
        void GridViewTest_Loaded(object sender, RoutedEventArgs e)  
        {  
            // NetRIA proxy  
            PortalDomainContext portalDomainContext = new PortalDomainContext();  
            LoadOperation<ValidValue> lo = portalDomainContext.Load(  
                portalDomainContext.GetValidValuesQuery(247, 154,  
                3, 8), GetValidValuesComplete, null);  
        }  
 
        private void GetValidValuesComplete(LoadOperation<ValidValue> lo)  
        {  
            if (!lo.HasError)  
            {  
                radGridView1.ItemsSource = lo.Entities;  
            }  
        }  
 
        private void checkSelall_Checked(object sender, RoutedEventArgs e)  
        {  
            if (checkSelall.IsChecked == true)  
            {  
                radGridView1.SelectAll();  
            }  
            else  
                radGridView1.UnselectAll();  
        }  
    } 

1 Answer, 1 is accepted

Sort by
0
Hector
Top achievements
Rank 1
answered on 02 Oct 2009, 08:56 PM
I found the problem by pure chance.  It happens that my grid was inside of a StackPanel and becase a stack panel auto grows, it will return all the rows at once.  I put it in a grid and set a fixed height and it works like a champ now.  This post is how I found my problem:

http://www.telerik.com/community/forums/wpf/gridview/number-of-rows.aspx#960379
Tags
GridView
Asked by
Hector
Top achievements
Rank 1
Answers by
Hector
Top achievements
Rank 1
Share this question
or