I have a pivotdatagrid that calculates specific values using the "CustomSummary" event and sets the cell color according to that value using the "CustomDrawCell" event. Everything is working as expecting, but i noticed that both of theses events are fired everytime, i scroll, select a cell, etc.. as i'am dealing with thousands of records when scolling for example, the UI looks slow and "freezing" because these to mentioned events are always firing. I tried to unregister the 2 events after the pivotgrid was fully loaded and cells values calculated and formatted according to desired colors but i noticed that again pivot grid redraws the cell and everything goes white and unformated however the scroll and the navigation inside the pivot grid speed is acchieved.
Is there anyway to preserve the cells format and values and avoid it to recalculate and redraw every time? That would brina huge performance to my application.
Thanks in advance,
Thank you for the report. The CustomDrawCell event must be called every time a cell is painted. So, it is impossible to prevent this event from being raised when you select a cell or scroll the PivotGrid. The CustomSummary event should not be raised in this case and our tests proves this. Perhaps, your code causes this event to be raised. To tell you why this event is raised, we need to see your code. Please send it to us and we will let you know what causes this behavior.
It would be nice if there was a workaround solution at least to avoid the CustomDrawCell, because it really slows down my UI response.
You're right..."custom draw summary" event doesn't trigger when cell is repainted, it was my mistake refering it.
If there is nothing else to do or any other sugestion you migh come up with, i'll close the thread.
Thank you and bets regards,
I'm afraid that the only solution to this problem is not to perform long calculations within the CustomDrawCell event handler. The PivotCustomDrawCellEventArgs provide a lot of information related to this event, and this information is quite enough for common tasks. I suggest that you try to optimize the CustomDrawCell event handler to improve performance.
Feel free to describe the problem in greater detail, if your task is rather specific, and the recommendation above doesn't fully resolve the problem. I'll try to find an appropriate solution for you.