User (Old forums)MemberAugust 20, 2007 at 3:51 pmPost count: 23064
I’ve been reading thru the forums for a way to display individual icons in a datagrid cell. Using the CellContentTemplate seems like overkill and does not work well if you don’t have data bound to an image in a table. For instance, if I have a column that says “Open Case” and I would like another column that has an image representing the Open Case status, I have no association in a database betwen the Open Case text and any icon in the database.
Just like I can swap controls out dynamically for input controls like a wincombobox, wintextbox, numerictextbox, etc, is it possible to replace a cell with a custom control or a windows control such as the picturebox? If so, this would be a neat solution since there is no image property on a wingrid cell.
Coincidentially, one limited workaround is to set a cell’s Background Image, BackgroundImageAlignment and HorizontalAlignments such that an image displays on the left of each cell and the text is centered, but this is limited to very small images no larger than the height of the cell. I’d hate to rely on this method, if possible.
Thanks again for your help.
Imported from legacy forums. Posted by John (had 2861 views)Xceed SupportMemberAugust 22, 2007 at 10:29 amPost count: 5658
There is already a type in the Grid to display images (or icons).
Here is a snippet that shows how to add icons to all the cells from a column (with an image type).
Column imageViewer = new Column( “Image”, typeof( System.Drawing.Image ) );
imageViewer.CellViewerManager = new ImageViewer();
gridControl1.Columns.Add( imageViewer );
foreach( Xceed.Grid.DataRow row in gridControl1.DataRows )
row.Cells[ “Image” ].Value = new Bitmap( @”C:\Windows.old\Program Files\Microsoft Office\OFFICE11\FORMS\1033\CNFNOT.ICO” );
Imported from legacy forums. Posted by CharlesB (had 3055 views)User (Old forums)MemberSeptember 12, 2012 at 11:53 pmPost count: 23064
How would you should an image in a cell if the column is a DataBoundColumn?
For instance, I want to show an up arrow is the value is 1 and a down arrow is the value is -1.
Imported from legacy forums. Posted by Mat (had 823 views)
- You must be logged in to reply to this topic.