Hello,
I'm trying to show an image on an cell. I've created a new column and changed the DataType. and in the InitializeRow i'm saying which photo should appear, but this don´t work. The column appears empty. Here´s my code:
InitializeLayout... gData.DisplayLayout.Bands[0].Columns.Add("New"); UltraGridColumn col = gData.DisplayLayout.Bands[0].Columns["New"]; col.DataType = typeof(Bitmap); col.Header.Caption = CM.GetString("New"); col.Header.VisiblePosition = 1;...
InitializeRow... if ((bool)e.Row.Cells["ReadByAssignedTo"].Value) img2 = new Bitmap(Properties.Resources.newTask); else
img2 = new Bitmap(Properties.Resources.oldTask);
e.Row.Cells["New"].Value = img2; //e.Row.Cells["New"].Appearance.ImageBackground = img2;...
Can you please tell me what's wrong with this code?
Thanks
I have tried the following code in the InitializeRow event of the UltraGrid and it work as expected.
if ((bool)e.Row.Cells["New"].Value) { img2 = Image.FromFile("First.jpg"); } else { img2 = Image.FromFile("Second.jpg"); }
//You are able to use this one to set the Background Imagee.Row.Cells["Image"].Appearance.ImageBackground = img2;
//Or you the following one to show your desired image as a value
e.Row.Cells["Image"].Value = img2;
So if your column is empty are you hooking you InitializeRow event to the UltraGrid?
Please try this at your end and let me know if you have any further questions.
Sincerely,
Danko Valkov
Developer Support Engineer
Infragistics, Inc.
That´s what i have too. But it don´t show any image. If i put this image in any other column as ImageBackground it works, but in this new column it don't appears. And how about the code to create the new column on the InitializeLayout that i posted? Is that correct?