Hello!
I have an issue with assigning the ImageIndex of GridCellElement.
Let’s take a simple code sample. An image list with a single image is assigned to the grid view. All settings are by default.
01.
public
partial
class
Form1 : Form
02.
{
03.
public
Form1()
04.
{
05.
InitializeComponent();
06.
07.
for
(
int
i = 0; i < 8; i++)
08.
radGridView1.Columns.Add(
new
GridViewTextBoxColumn());
09.
10.
for
(
int
i = 0; i < 8; i++)
11.
radGridView1.Rows.Add(radGridView1.Rows.NewRow());
12.
}
13.
14.
private
void
radGridView1_CellFormatting(
object
sender, CellFormattingEventArgs e)
15.
{
16.
if
((e.CellElement.RowIndex + e.CellElement.ColumnIndex) % 2 == 0)
17.
{
18.
e.CellElement.ImageIndex = 0;
19.
}
20.
}
21.
}
When I build this sample with “RadControls for WinForms Q3 2009 SP1” it shows the “chessboard”. But when I build it with the latest “RadControls for WinForms Q2 2010 SP2” it shows an empty grid.
To have it running as expected I have to do the following workaround (see line 5):
1.
private
void
radGridView1_CellFormatting(
object
sender, CellFormattingEventArgs e)
2.
{
3.
if
((e.CellElement.RowIndex + e.CellElement.ColumnIndex) % 2 == 0)
4.
{
5.
e.CellElement.ImageIndex = -1;
6.
e.CellElement.ImageIndex = 0;
7.
}
8.
}
So, perhaps this is a bug.
Thank
you.