I have a column of datatype bitmap. the value is composed of a set of icons merged into an image side by side which can vary in numbers. My problem is that when the column is resized the images shrink to fit to the point where no images are visible. How can I prevent this from hapenning? I'd like the image to be truncated instead of resized, only show what fit's in the cell and possibly have a "..." or similar indicator at the end to indicate that not all icons are shown.
aUGRow.Cells["flags"].Value = GetCombinedImage(wSignatureNeeded); //GetCombinedImage returns a Bitmap.
The flag column is configured as follows:
column.DataType = typeof(Bitmap);
column.CellAppearance.ImageVAlign = Infragistics.Win.VAlign.Middle;
column.FilterEvaluationTrigger = FilterEvaluationTrigger.OnEnterKey;
column.FilterOperatorDropDownItems = FilterOperatorDropDownItems.Equals | FilterOperatorDropDownItems.Contains | FilterOperatorDropDownItems.DoesNotContain;
column.SortComparer = new FlagComparer();
column.GroupByEvaluator = new FlagEvaluator();
Are you setting the Image on the cell? Or are you using ImageBackground (or BackgroundImage, I always forget which way it is)?
Are you cells using a different editor like maybe you are using masking or a combo?
Thank's for the quick reply
I've tried the code you posted but it doesn't seem to do anything at all? I stepped through the code and the creation filter does get hit but the image still shrinks to fit the cell. Maybe I missed something? I tried feeding different sizes to the new rectangle you are creating to see the impact it would have on the cell image, again nothing seemed to change at all.
This doesn'tdo the ellipsis like you wanted, but it seems to work pretty well:
public class MyCreationFilter : IUIElementCreationFilter { #region IUIElementCreationFilter Members public void AfterCreateChildElements(UIElement parent) { if (parent is EditorWithTextUIElement) { ImageUIElement imageUIElement = parent.GetDescendant(typeof(ImageUIElement)) as ImageUIElement; if (imageUIElement != null) { imageUIElement.Rect = new Rectangle( imageUIElement.Rect.X, imageUIElement.Rect.Y, imageUIElement.Image.Width, imageUIElement.Rect.Height); } } } public bool BeforeCreateChildElements(UIElement parent) { return false; } #endregion }