I have a grid that uses a user control to display the cells.
I went through all the GridGenericControlCellRenderer and GridGenericControlCellModel stuff and it works fine.
If and only if I scroll the grid using the mousewheel and then click on a cell, the grid loses some reference and starts to paint erratically.
More in detail, I get the cells displayed with the background color of the user control, but the textboxes contained in the control are not visible.
This behaviour is not deterministic: it happens only by using the mousewheel, but not always.
Sometime I am able to restore the grid by scrolling to the topmost row and then clicking in a cell. Often I must resort to restarting the application.
The fact that the backgound color is right implies that the control is displayed and has been initialized, because the color depends on the data the control is supposed to display.
I know this problem will be next to impossibile to reproduce for you, but can you suggest where I should look find out if it''s a bug of mine or in the grid?
ADAdministrator Syncfusion Team October 1, 2004 06:30 AM
Are you trying to have derive a celltype holding a usercontrol that is to be used in multiple cells. If so, you will need two copies of your usercontrol for use in your renderer''s Draw method. One is used to handle the active current cell, and the other is used to do the static drawing for all other cells. Are you doing this?
Have you looked at the Grid\Samples\DataBound\RepeaterUserControlSample? It actually has a derived cell type that puts a UserControl in a grid cell. It has extra stuff to handle some databinding that you could remove.
RRRaul RosenthalOctober 1, 2004 07:03 AM
Yes, I have two controls and have perused the samples. I think that I don''t need two controls, because my grid is strictly read-only (the user can change the values in the cells, but only by means of other controls), but I kept them nevertheless.
Also, I followed the suggestions you can find in thread "GridStyleInfoCustomProperties & Virtual Data" in the Grid Forum.
The fact that the problem appears only by using the mousewheel makes me think that ther could be some bug in the handling of the latter, but so far I have not ventured in your code.
ADAdministrator Syncfusion Team October 1, 2004 07:24 AM
Normally, it is exactly when you scroll that 2 controls are needed. One control holds the active cell settings (which you may not have), and the other control is constantly being reset to draw the other cells as they are needed.
Are you using the base class genericrenderer''s Draw method to draw the inactive cells? If not, you might try it. Set e.Style.Control to be the inactive control (after you have properly set its values), and then call the baseclass.
If you can post a small sample showing the problem, we can try to spot something here.
RRRaul RosenthalOctober 5, 2004 07:23 AM
I had a bug in my control that caused it to fail to initialize properly when it was the one of the pair that is used when the cell has the focus.
It had nothing to do with the grid, it was entirely my fault.
Thank you for having pointed me to the draw control/edit control handling.