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.

PictureBox in a GridGroupingControl Binding with IList

Thread ID:

Created:

Updated:

Platform:

Replies:

68335 Sep 18,2007 01:02 PM Sep 21,2007 12:17 AM Windows Forms 2
loading
Tags: GridControl
Russell Coombes
Asked On September 18, 2007 01:02 PM

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

Rajagopal [Syncfusion]
Replied On September 21, 2007 12:16 AM

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

Rajagopal [Syncfusion]
Replied On September 21, 2007 12:17 AM

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

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.

;