Is there a way to set a custom image for the Column Chooser and make it larger?

Answered (Not Verified) This post has 0 verified answers | 12 Replies | 3 Followers Thread's RSS feed.

lievencardoen
Points 2,100
Replied On: Thu, Oct 12 2017 4:12 AM Reply

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

  • Post Points: 5

All Replies

lievencardoen
Points 2,100
Replied On: Thu, Oct 12 2017 5:19 AM Reply

  • Post Points: 20
Mike Bowshewicz
Points 11,825
Infragistics Employee
Replied On: Mon, Oct 16 2017 2:58 PM Reply

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.

Sincerely,

Mike B
Software Developer

  • Post Points: 20
lievencardoen
Points 180
Replied On: Tue, Oct 17 2017 4:04 AM Reply

That would be great! Thx!

Lieven

  • Post Points: 20
Mike Bowshewicz
Points 11,825
Infragistics Employee
Replied On: Tue, Oct 17 2017 3:10 PM Reply

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;
   }
}

Sincerely,

Mike B
Software Developer

  • Post Points: 20
lievencardoen
Points 180
Replied On: Wed, Oct 18 2017 7:55 AM Reply

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.

Lieven

  • Post Points: 5
lievencardoen
Points 180
Replied On: Wed, Oct 18 2017 7:59 AM Reply

Hi Mike,

Don't i also need a drawfilter? Could you try it out in a little example (solution)?

Thx, Lieven

  • Post Points: 5
lievencardoen
Points 180
Replied On: Wed, Oct 18 2017 9:13 AM Reply

Hi Mike,

As you can see, the Image size just remains the same.

Is there also a way to enlarge the right arrow in the Row? (I can create a different thread for that one if you want, but maybe it can be done with the same CreationFilter....).

Lieven

  • Post Points: 5
lievencardoen
Points 180
Replied On: Thu, Nov 2 2017 5:05 AM Reply

Hi Mike,

Any update on this?

Can I use the same CreationFilter to add space before the Column Header Text?

Thx, Lieven

  • Post Points: 20
Mike Bowshewicz
Points 11,825
Infragistics Employee
Answered (Not Verified) Replied On: Thu, Nov 2 2017 4:35 PM Reply
Suggested by lievencardoen

Hi Lieven,

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.

Sincerely,

Mike B
Software Developer

  • Post Points: 20
lievencardoen
Points 180
Replied On: Fri, Nov 3 2017 6:22 AM Reply

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://www.infragistics.com/community/forums/p/111191/521654.aspx#521654

Thx, Lieven Cardoen

  • Post Points: 5
lievencardoen
Points 180
Replied On: Wed, Nov 8 2017 3:50 AM Reply

Hi Mike, is there also a way to enlarge the arrow in the Row Header? (the small arrow)

Thx, Lieven

  • Post Points: 5
lievencardoen
Points 180
Replied On: Wed, Nov 8 2017 4:45 AM Reply

Found it. Thx.

  • Post Points: 5
Page 1 of 1 (13 items) | RSS