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

How to make cellstyleselector only rises on changed cells?

7 Answers 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ifdev02
Top achievements
Rank 1
Ifdev02 asked on 14 Aug 2012, 07:49 PM
Hi 
I have issues with gridview performance and need to do every bits and pieces to make it works for fast data updates.
I have debugged in the cellstyleselector if a cell data (says double) was changed,

1) it seems the cellstyleselector cells of the whole column were then fired - every rows.
2) worse than that other columns that implement cellstyleselector then fired as well.

Are there way to make sure only cell that has property changed fires cellstyleselector event? 

Since almost every column implement cellstylesector - my UI just too slow for users.
If cellselector do not work for me you do have some snippet so I can change cell property base on value condition directly - so only changed cell updates.

BR.

PS. Are there better approach so that i can raise selector event manually like so
editedCell.Style = editedCell.Column.CellStyleSelector.SelectStyle(parentRow.DataContext, editedCell); 
However, I am working with observable collection, I cannot get to the cell directly.

Updated...
Any Ideas? On how to prevent repeat rises of cellstyleselector on unchanging cell?

May be I could dig into source code of this cellstyleselector can you tell me what dll and location of this code. I have never built the source code but it might be worth taking time to do so.

Updated...
First I am changing from single notifypropertychanged to all propertychange (so I do all properties changes then rise notify all), since cellstyleselector run through all cells - at least it would run only once - I am testing if this assumption is true or not.

What are your ideas?

Updated... Aug 21, 2012

Any ideas?

7 Answers, 1 is accepted

Sort by
0
Ifdev02
Top achievements
Rank 1
answered on 21 Aug 2012, 03:37 AM
?
0
Håkan
Top achievements
Rank 1
answered on 04 Feb 2014, 09:05 AM
Hi!

I have the same problem using a CellStyleSelector.
On every keystroke in a cell, it gets called.
My style selector sets background and foreground color in the cell depending on its valu.
For me it would be enough to call it once for just the cell I change, and after I leave it.

Regards,
Håkan
0
Dimitrina
Telerik team
answered on 04 Feb 2014, 09:14 AM
Hello Håkan,

The CellStyleSelector should be reevaluated on a PropertyChanged notification. Do you raise such on each key stroke?

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Håkan
Top achievements
Rank 1
answered on 04 Feb 2014, 09:31 AM
Hi there!

Thanks for the very fast response!

Indeed I had a property changed event fired that I could get rid of.
That partly solved my problem.
Now for the second one, it still calls the StyleSelector for each and every cell in the entire grid, all rows and all columns.
This makes my grid very slow. And it gets slower and slower for every row I add.

Is there anyway I can get it to be called only for my modified cell?

Regards,
Håkan
0
Dimitrina
Telerik team
answered on 04 Feb 2014, 03:16 PM
Hi Håkan,

The CellStyleSelector should be reevaluated for the edited cell only. I have also attached the demo project I tested on. Would you please test it at your side and let me know how is your implementation different from mine? 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Håkan
Top achievements
Rank 1
answered on 06 Feb 2014, 08:14 AM
Hi!

I have been digging a little deeper in my problem now and here is what I came up with.

My grid is bound to an observable collection of dynamic objects.
The grid has two fixed columns in the beginning and a variable number of columns after that.
In each of the dynamic columns I have a ComboBox. When I select something in the ComboBox 11 properties on the current object is updated, two of them are bound to the fixed columns and the nine others to the current column i edit.

It seems that every property I set will raise the PropertyChanged event, therefore  calling my CellStyleSelector 11 times for each and every cell on the row which in some cases can be up to 150 cells.
So the CellStyleSelector gets called 1650 times at this point, every time setting the same foreground and background color of the cell.

So my question is: Is there anyway to disable this automatic update and call it my self on the CellEditEnded event instead.
And why is it called for every cell in the row, could it be because it also updates the first two columns?

Regards,
Håkan

0
Dimitrina
Telerik team
answered on 10 Feb 2014, 03:57 PM
Hi Håkan,

I am afraid there is not a way to disable those notifications. I am not sure how have you defined your collection of dynamic objects. Do you have the same problem when defining the collection as on this online demo?

Regards,
Didie
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

Tags
GridView
Asked by
Ifdev02
Top achievements
Rank 1
Answers by
Ifdev02
Top achievements
Rank 1
Håkan
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or