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. Image for the cookie policy date

CellRenderer.Dispose() in a custom cell type never called when deleting a row

Hi, i have the following problem: When I delete a row in my grid, not all resources of my custom cell type were cleaned up - particularly objects within my renderer. I thought I could use the dispose method, but that one is only called when the grid disposes itself. I tried to find a way to call the Dispose method myself but I don''t get into my renderer, I am only able to call the Dispose method of the cell model. Is there a way that the dispose method of the renderer is implicitly called when a row is deleted? Thanks in advance Michael

2 Replies

AD Administrator Syncfusion Team July 29, 2005 08:09 AM UTC

This behavior is by design. You add the cellmodel to the grid (grid.CellModels actually). So, it is the grid that owns teh cellmodel (and the corresponding cellrenderer). You could choose to use the celltype in more than one row, so just removing a row does not tell the grid to get rid of teh custom cell type. One thing you could do is to move your disposable resources from the renderer to the cellmodel class. You could make them internal, and access them in your renderer from this.Model. Then you could handle the cellModel.Dispose to dispose them. You should remove the cellmodel from grid.CellModels before you dispose it after deleting your row.


MM Michael Mann July 29, 2005 08:22 AM UTC

Hi, that does make sense. Thinking about your answer I have to admit, that my approach is getting wrong. I only want to get sure, that resources of my cell type are released when a row with that cell type is deleted. Thanks for your fast reply Michael

Loader.
Up arrow icon