Always display user controls in grid cells as if it is the current cell

I have a dynamicaly changing user control displayed in a cell. If I set the cell as current, everiting is ok. The changes in the user control are displayed in the grid. If the cell is not the current, the user control is static. Furthermore if the cell is the current one the user control is expanded to match the control bounds. How can I make the not current cells display the user control as if they are the current one?

4 Replies

AD Administrator Syncfusion Team September 15, 2005 12:32 PM UTC

Hi Georgi, What you refer by ''user control is static''? Are you deriving your custom cell renderer from GridGenericControlCellRenderer? If so are you having two instances of usercontrol, one for static drawing and the other for current cell like these samples: Windows\Grid.Windows\samples\CellTypes\CalendarCells Windows\Grid.Windows\samples\CellTypes\SliderCells Can you post more information on your approach? A small sample would help us resolve the issue better. Best regards, Jay N


GK Georgi Kashev September 15, 2005 01:53 PM UTC

Well, The user control has a build-in logic that refreshes some displayed data. I have created a simple project that demonstrates the problem. It shows a grid with two cells. Both cells are set to display a user control which shows the current time. You will notice that the clock runs only if the cell is selected. Otherwise it is stopped. Further more at the initial loading both cells remain empty... Can you fix this sample? I need both clocks to run. UserControlInGrid_4894.zip


AD Administrator Syncfusion Team September 16, 2005 06:50 AM UTC

Hi Georgi, The ''Control'' celltype is designed such that if you assign a control to style object, grid handles the drawing in two different scenarios. For the currentcell which is in focus, it just places the control at the particular cell and gives focus to it. For other cells, it renders the control to a bitmap and then draws the bitmap instead since there won''t be active editing in it. In your scenario, you could set focus to the control in all the cells (both current and others) by having a custom cell and overriding GridGenericControlCellRenderer.OnDraw method. Please refer this modified sample to see if that helps. UserControlInGrid.zip Best regards, Jay N


GK Georgi Kashev September 16, 2005 08:23 AM UTC

It''s exactly what I needed. Thanks a lot.

Loader.
Up arrow icon