An image says more ;-). I would like to have a custom image and make it larger. (for the Column Chooser Icon).
Is this possible?
Maybe with a creationfilter? Or setting a property?
Can you provide me with an example?
Kind regards, Lieven Cardoen
Hello,
You can change the image itself by setting the ultraGrid1.DisplayLayout.Override.RowSelectorHeaderAppearance.Image property.
I think it should be possible to change the size using a creation filter. I am working on this. If it is possible, I will provide you with the code I used.
Please let me know if you have any questions.
That would be great! Thx!
Lieven
Hi Lieven,
You can increase the size of the column chooser button by setting the following properties:
ultraGrid1.DisplayLayout.Override.RowSelectorWidth = 100;ultraGrid1.DisplayLayout.Bands[0].ColHeaderLines = 5;
You can use this creation filter to increase the size of the image once the button is larger:
public class ColumnChooserButtonCreationFilter : IUIElementCreationFilter{ public void AfterCreateChildElements(UIElement parent) { if (parent is ImageAndTextUIElement && parent.Parent is ColumnChooserButtonUIElement) { UIElement imageElement = parent.GetDescendant(typeof(ImageAndTextDependentImageUIElement)); imageElement.Rect = parent.Rect; } } public bool BeforeCreateChildElements(UIElement parent) { return false; }}
public bool BeforeCreateChildElements(UIElement parent) { return false; }}
Hi Mike,
Tried this and the image doesn't increase... The code is triggered. The parent rect has the correct values. But the imageElement doesn't seem to do anything with its new Rect.
Don't i also need a drawfilter? Could you try it out in a little example (solution)?
Thx, Lieven
Found it. Thx.
Hi Mike, is there also a way to enlarge the arrow in the Row Header? (the small arrow)
Thx, will try this immediately. And is there a way, related to my other question, to use the same CreationFilter to have space before the Column Header Text?
See https://es.infragistics.com/community/forums/p/111191/521654.aspx#521654
Thx, Lieven Cardoen
The reason that the image does not appear larger is because the default image we provide is already at full size. There are two ways you can resolve this:
1) Provide a larger image. The larger image will use up more of the space. You can set the image like this:
ultraGrid1.DisplayLayout.Override.RowSelectorHeaderAppearance.Image = new Bitmap(@"../../Image.jpg");
2) Enable scaling on the UI element. You can turn scaling on by adding a line to the creation filter in AfterCreateChildElements after we get the ImageAndTextDependentImageUIElement:
(imageElement as ImageAndTextDependentImageUIElement).Scaled = true;
I do not recommend this approach if you plan to use the provided image, as the default image is small and may not look good scaled up.
I've attached a sample that demonstrates these approaches. One approach or the other should be sufficient, but both won't hurt anything.
Any update on this?
Can I use the same CreationFilter to add space before the Column Header Text?