AD
Administrator
Syncfusion Team
November 4, 2004 06:27 PM
Do you mean the new row that you added (as opposed to the new column)?
If it is the row, then you can handle the PrepareViewStyleInfo event. In the handler, if e.COlindex and e.RowIndex point to the cell where you want the image, you can set e.Style.ImageList, e.Style.ImageIndex to specify the image you want to see. Additionally, you will have to set e.Style.CellType = "Static" so the image drawing code will be hit. (The default drawing for teh header celltype does not draw images.) There may be other properties you''ll want to set as well.
There are other ways to do this if this will not serve your needs.
BH
Bernard Herrok
November 4, 2004 08:28 PM
it''s just a standard row, made in into a column.
.Model.Rows.HeaderCount = 1
>Do you mean the new row that you added (as opposed to the new column)?
>
>If it is the row, then you can handle the PrepareViewStyleInfo event. In the handler, if e.COlindex and e.RowIndex point to the cell where you want the image, you can set e.Style.ImageList, e.Style.ImageIndex to specify the image you want to see. Additionally, you will have to set e.Style.CellType = "Static" so the image drawing code will be hit. (The default drawing for teh header celltype does not draw images.) There may be other properties you''ll want to set as well.
>
>There are other ways to do this if this will not serve your needs.
AD
Administrator
Syncfusion Team
November 5, 2004 01:49 AM
I think the technique described above should work in this case. Here is a minimal sample.
WindowsApplication9_235.zip
BH
Bernard Herrok
November 7, 2004 03:17 PM
Ok, i got that to work. But how i change images at runtime?
i have CellDoubleClick event, that changes the imageindex but it doesn''t update view.
I thought that preparestyleview method was called every time the the grid refreshed.
>I think the technique described above should work in this case. Here is a minimal sample.
>
>
>
WindowsApplication9_235.zip
>
>
BH
Bernard Herrok
November 7, 2004 04:06 PM
Also, can i align the image to top on merged cells.
i have dynamically merged cells and when image''s attached, it aligns in the center.
thanks
AD
Administrator
Syncfusion Team
November 7, 2004 05:59 PM
What code are you using in your DounleClick handler? If you are trying to set grid[row, col].ImageIndex = ???, this will not work. In a GridDataBoundGrid, you cannot set cell specific properties (other than CellValue). Instead, you have to dynamically set the ImageIndex in PrepareViewStyleInfo.
If you can post a sample project showing what you are trying to do, maybe I can suggest something.
BH
Bernard Herrok
November 7, 2004 07:30 PM
your right, i can''t set the property outside the prepareviow.
but if you use datagrid.refresh, it works.
thanks!