|
-
April 19th, 2009, 03:36 PM
#1
[RESOLVED] DataGrid - rendering cell
Hi all,
I am using Visual Studio C#, and I am new to C#
At the moment, I am getting myself familiarize with DataGrid. It seems like I can only put text in the cells of the DataGrid, I am wondering if I can render a image into the DataGrid cell.
I have a program that will list the files in a directory, and I want to display an image on a DataGrid cell according to the file types.
For example, if the file is a mp3 file, then I will put a MP3 icon into the cell; if the file is a .wav file, then I will put a windows media player icon into the cell; if the file is a text file, I will put a text file icon into the cell.
Could anyone tell me if this is possible to implement? and perhaps give me a hint on how this should be implemented.
Any help is appreciated,
Thank you,
kab
Last edited by kabilius; April 27th, 2009 at 09:33 AM.
-
April 20th, 2009, 04:03 PM
#2
Re: DataGrid - rendering cell
I am not sure which version of Visual Studio you are using. Assuming Visual Studio 2005 Windows project, there is DataGridViewImageColumn in DataGridView control. You can bind image data to the column, or set image data to cell value. If you are doing 2005 Web project, just set the column to template field and then play around.
Hope it helps.
The difficulty is that you have no idea how difficult it is.
.Net 3.5/VS 2008
-
April 24th, 2009, 01:34 PM
#3
Re: DataGrid - rendering cell
 Originally Posted by jasonli
I am not sure which version of Visual Studio you are using. Assuming Visual Studio 2005 Windows project, there is DataGridViewImageColumn in DataGridView control. You can bind image data to the column, or set image data to cell value. If you are doing 2005 Web project, just set the column to template field and then play around.
Hope it helps.
Hi Jasonli,
I found out that I need to create my own DataGridTableStyle and DataGridColumnStyle, and bind the customed styles to my datagrid. The process is still a bit blur to me at the moment. I have found a code example online and reading through it right now.
If you are interested, I can post it up for you to look at.
Thank you for your help,
kab
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|