We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Grid with user control a cell style

Thread ID:

Created:

Updated:

Platform:

Replies:

19705 Oct 1,2004 06:58 AM Oct 5,2004 08:23 AM Windows Forms 4
loading
Tags: GridControl
Raul Rosenthal
Asked On October 1, 2004 06:58 AM

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? Thank you. Raul Rosenthal SDB SpA

Administrator [Syncfusion]
Replied On October 1, 2004 07: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.

Raul Rosenthal
Replied On October 1, 2004 08: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.

Administrator [Syncfusion]
Replied On October 1, 2004 08: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.

Raul Rosenthal
Replied On October 5, 2004 08:23 AM

All right. 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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;