User (Old forums)MemberNovember 30, 2006 at 11:59 amPost count: 23064
What is the best way to sort a column that contains images?
If I were to set the DataComparer of the column to a class implementing IComparer, what am I going to compare? Is “object x” and “object y” the cells to compare? Or is it the value of the cells (which is, in this case, an image from an image list)?
Sorry if this is a dumb question. I really tried to research things in the help and documentation site.
Imported from legacy forums. Posted by hepkat (had 5094 views)User (Old forums)MemberDecember 1, 2006 at 3:34 pmPost count: 23064
If the column contains an Image or Bitmap or Byte type, it is difficult to sort such contents, because the value is the image.
If the column contains an ID which is displayed as an image (like a ComboBox), then the comparer receive this ID, and it can be used to do the sorting.
Imported from legacy forums. Posted by André (had 322 views)User (Old forums)MemberDecember 6, 2006 at 9:21 amPost count: 23064
I’m not exactly sure what you mean.
How would I set the cell value to an ID, and get an image displayed? This is possible with the data I’m using, but I haven’t been able to find anything in these forums yet that describe this. Care to enlighten me? 🙂
Imported from legacy forums. Posted by hepkat (had 455 views)User (Old forums)MemberDecember 7, 2006 at 10:20 amPost count: 23064
Look at the following http://doc.xceedsoft.com/products/XceedGrid/ComboBoxViewer.html from the online help documentation. It gives an example with the employee table of the Northwind DB, where it displayed an image and text in the same cell, and which is based on the ID of the employee.
ComboBoxViewer viewer = new ComboBoxViewer( dataSet11, “Employees”, “EmployeeID”, “Photo”, ImageArea.Left, new Size( 32, 32 ), “%FirstName% %LastName%” );
gridControl1.Columns[ “EmployeeID” ].CellViewerManager = viewer;
gridControl1.Columns[ “EmployeeID” ].Title = “Employee”;
Simply set the last two parameters to an empty string, and only on the image will be shown.
Imported from legacy forums. Posted by André (had 3756 views)User (Old forums)MemberApril 22, 2009 at 3:01 amPost count: 23064
if we are adding a “Image” column how we can do the sorting. Is there any other ID property to set for same image…
//Defining the Image column
Xceed.Grid.Column imageViewer = new Xceed.Grid.Column(“Info”, typeof(System.Drawing.Image));
imageViewer.CellViewerManager = new Xceed.Grid.Viewers.ImageViewer();
//Images are loaded through program, (static)
if (!string.IsNullOrEmpty(delProb) && !string.IsNullOrEmpty(renewal))
row.Cells[“Info”].Value = global::Red.Main.Properties.Resources.New;
else if (!string.IsNullOrEmpty(delProb))
row.Cells[“Info”].Value = global::Red.Main.Properties.Resources.Symbol_Restricted;
else if (!string.IsNullOrEmpty(renewal))
row.Cells[“Info”].Value = global::Red.Main.Properties.Resources.Info;
Imported from legacy forums. Posted by bdmsoft (had 521 views)User (Old forums)MemberApril 22, 2009 at 12:54 pmPost count: 23064
First, I have updated the link to the documentation, so you can have more information on this.
Second, the column cannot be define as an Image column if you want to be able to sort it. As in the code snippet I provided, the column must be some kind of ID (i.e. “EmployeeID”) that refers to the row in the DB, and from that row the image is retrieve by the data binding mechanism, and is shown in the ComboBoxViewer instead of the ID itself. There is no way around that.
Imported from legacy forums. Posted by André (had 3521 views)
- You must be logged in to reply to this topic.