Hi All,
I am adding an image to a cell and aligning it to the top left hand corner using the ImageHAlign and ImageVAlign of the cells Appearance object. My problem is that there is still a small gap between the left hand side of the image and the cells left border, is there anyway that I can get rid of this gap?
I'm aware of the CellPadding property on the grid but I only want to reduce the padding for individual cells.
Thanks in advance,
Denis.
Hi Dennis,
fatherlyons said: I am identifying the ImageUIElement and reducing the X co-ordinate of it's RectInsideBorders property by 1
That doesn't really make sense. I don't think that RectInsideBorders is settable.
What you need to do is determine what element contains the ImageUIElement and handle the AfterCreateChildElements of that element. Then, you use GetDescendant on the containing element to get the ImageUIElement contained in it. Then set the Rect of the ImageUIElement to a new rect with a location of 0,0 and same size as the current rect of the element.
If the cell contains text in addition to the image, you will also need to get the TextUIElement in the same way and shift it's Rect over to the left by the same amount and increase it's width by the same amount so that it fills up the space.
Thanks Mike,
I'm now using a creationfilter and implementing the AfterCreateChildElements method. In this I am identifying the ImageUIElement and reducing the X co-ordinate of it's RectInsideBorders property by 1 so that the image is against the left hand edge of the cell, at least I thought that would do it but it doesn't seem to be having any effect on the position of the image. Is there a specific way I need to reposition the image?
Denis
Hi Denis,
If CellPadding is no good for your particular requirements, then the only other option would be to use a CreationFilter to move the ImageUIElement within the cell.