Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
380
Having trouble with putting an image in a cell
posted

I'm getting rather frustrated trying to display an image in a cell.

First, I'm adding an extra column maually to contain the image cell, like this:

Infragistics.Win.UltraWinGrid.UltraGridColumn iconColumn= grid.DisplayLayout.Bands[0].Columns.Add("IconColumn");
grid.DisplayLayout.Bands[0].Columns["IconColumn"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Image;
grid.DisplayLayout.Bands[0].Columns["IconColumn"].Hidden = false;
grid.DisplayLayout.Bands[0].Columns["IconColumn"].Header.VisiblePosition = 0;
grid.DisplayLayout.Bands[0].Columns["IconColumn"].Header.Caption = "Icon";

Next, in the InitializeRow event, I say:

if (Convert.ToBoolean(e.Row.Cells["RadioExists"].Value.ToString())== true)
  {
    e.Row.Cells["IconColumn"].Appearance.BackColor = System.Drawing.Color.Black;
    e.Row.Cells["IconColumn"].Appearance.Image = System.Drawing.Image.FromFile(@"FilePath");

  }

it colors the cell fine, but doesn't show my image. I'm sure the image exists and it is loaded because I've checked the Appearance.Image after it runs and there is a value in there. What am I doing wrong?