I have a column where I'm setting an image in the appearance of the cell (i.e. cell.Appearance.Image =) Not every cell in the column will have the same image, but all images are of the same size. Call this Column A.
At the same time, another column contains images via the cell value being of System.Drawing.Image. The size of the image in this column will always be larger (both height and width) than the image in the other column. Call this Column B.
I have RowSizing set to fixed because I don't want the user to be able to resize rows. However, in the InitializeRow method, I examine the size of the image in Column B (if it exists, it doesn't have to unlike column A). I then set the row size to be the height of the image in column B.
The problem I have is that the size of the image in column A grows to the height of the row, and I don't want it to. I want it to maintain the same size no matter how the row is sized.
I've looked into using a draw filter to manually set the rect of the ImageUIElement. But it seems to disregard my sizes when the row gets resized.
Essentially what I need is for the ImageUIElement to not autosize itself (which it appears to do) when the row resizes.
Any help would be appreciated. Thanks!
Chris Rowland
Hi Chris,
What version of the grid are you using? I tested this out and the size of the image applied to the cell via the Appearance does not change based on the height of the row.
Perhaps this is a bug in an old version of the grid that has been fixed?
If that is the case, and you are using an old version of the grid and you cannot upgrade and you want to work around this, you shouldn't try to change the sizes of UIElements in a DrawFilter, this is more the province of a CreationFilter.
Thanks for the Reply Mike.
We're currently on 10.1 (I know, a good bit behind). But you are indeed correct that this doesn't appear to be an issue, even in my version. I set up a very simple case of what I described, and now matter how large I sized the row, the appearance.image didn't change in size.
So it's obviously something I'm doing....but I'm at a loss as to what it is. I've checked all the things I can think to check. I've removed any and all draw/create filters. Just using the stock image functions.
I'm attaching an image in hopes you might be able to point me in the right direction.
You'll see my grid with 4 columns.
Column "Competitor Item" is an int
Column "Manufacturer" is a string.
Column Image 1 and Image 1 Thumbnail are System.Drawing.Image
In the Manufacturer column, I've set an image that's 48x48 in the appearance, with VAlign = top and HAlign = left.
In the InitializeRow method, I check the image 1 column to see if there's an image value. If there is, I set the row height = image.height. Otherwise I use whatever height the row defaults to (in this case 22).
So for row 1, with no image 1 value, the row height is 22. The 48x48 image is sized down and maintains it's aspect ratio.
Row 5 gets assigned a height of 480 (the image is 640x480). The arrow image grows to it's full 48x48 (I'd rather it didn't, but that makes sense). But more troubling for me is the ImageUIElement it's contained in grows to take up the entire height of the cell, as well as growing in width. It's not obvious in the screenshot but it extends to the edge of the text, pushing the text to the right and making the value not line up with the value in row 1.
What I'm trying to do (and what I'm expecting) is have the size of the arrow be the same for both row 1 and 5, and as a result of that "manuf" would line up with "5000526" in the column
Is there anything in this mess that might help you help me?
Really appreciate it.
If you require any further assistance with this issue, please let me know.
Sincerely,Chris KDeveloper Support EngineerInfragistics, Inc.www.infragistics.com/support