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
close icon

PictureBox in a GridGroupingControl Binding with IList

Hi,

I am using a GridGroupingControl to display images within the grid. I use the PictureBoxCellModel and PixtureBoxCellRenderer as examples for how to do this. As I am binding to an IList, I cannot set the cell style directly - instead I look to set it having added the columns, like so:

GridStyleInfo style = grid.TableModel.ColStyles["MyColumn"];

style.CellType = "PictureBox";

I also use "PictureBox" when I add the Cell Model:

grid.TableModel.CellModels.Add("PictureBox", new PictureBoxCellModel(gridControl1.Model));

However, this does not display images! I noticed that after setting the relevant ColStyle's 'CellType' to "PictureBox", the 'CellType' is still set to "TextBox"!!! Hence, the 'OnDraw' and 'OnLayout' methods never execute in the PictureBoxCellRenderer!

A colleague told me of a way round this - I had to set the style's CellType in the 'QueryCellStyleInfo' event instead. I did this and it now works. But it makes no sense why! I should be able to set the style's CellType at the same point of adding the CellModel. I see no logical reason why I have to grab the 'QueryCellStyleInfo' event and then have to set the CellType at this point. I have wasted way to long trying to solve this unobvious problem.

Can Syncfusion please let me know why I have to use the 'QueryCellStyleInfo' event, or, could you provide a better way of setting the CellType on a style?

Regards,
Russell

2 Replies

RA Rajagopal Syncfusion Team September 21, 2007 04:16 AM UTC

Hi Russell,

Thanks for your interest in Syncfusion Products.

You can also the set your custom celltype using the below code

GridTableCellStyleInfo style = this.gridGroupingControl1.TableDescriptor.Columns["DateTime"].Appearance.AnyRecordFieldCell;
style.CellType = "PictureBox";

The QueryCellStyleInfo is the event that gets triggered for each cell in grid and let the user to customize the display of the cells. This is the best place to apply style settings for the grid cells.

Let me know if you need any further information.

Regards,
Rajagopal


RA Rajagopal Syncfusion Team September 21, 2007 04:17 AM UTC

Hi Russell,

Thanks for your interest in Syncfusion Products.

You can also the set your custom celltype using the below code

GridTableCellStyleInfo style = this.gridGroupingControl1.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell;
style.CellType = "PictureBox";

The QueryCellStyleInfo is the event that gets triggered for each cell in grid and let the user to customize the display of the cells. This is the best place to apply style settings for the grid cells.

Let me know if you need any further information.

Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon