Hi All,
I have enabled cardview for the wingrid and have disabled using OS Themes so I could apply my custom backgrounds for the cardview header. Once I have disabled using OS Themes, the Collapse\Expand images have changed. I would like to setup my own custom images for this, would greatly appreciate someone's help reg. the same
Many Thanks
Ponnu
Unless I missed a property setting, you will probably have to do this using a DrawFilter. Here is a forum post that goes into the general concepts of these filters:
http://forums.infragistics.com/forums/p/5376/24232.aspx#24232
For this particular case, here is a drawfilter I wrote:
class MyFilter : IUIElementDrawFilter{ public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { if (drawParams.DrawPhase == DrawPhase.BeforeDrawElement) { UltraGridRow ugr = (UltraGridRow)drawParams.Element.GetContext(typeof(UltraGridRow)); Bitmap bmp; if (ugr.IsCardCompressed) { bmp= (Bitmap)Bitmap.FromFile("16_excel.gif"); } else { bmp = (Bitmap)Bitmap.FromFile("16_print.gif"); } drawParams.DrawImage(bmp, drawParams.Element.Rect, true, null); return true; } return false; }
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { if (drawParams.Element is CardExpansionUIElement) { return drawParams.DrawPhase; } return DrawPhase.None; }}
To hook up this filter to your grid its:
this.ultraGrid1.DrawFilter = new MyFilter();
You can also probably pass in the images through the constructor of your class as well.
Hi Sung,
Thanks, that worked. I have modified the above code so that the image doesn't scale down and fits in correctly as well.
Have two more questions,
1. Is it possible to increase the CardCaptionHeader height rather than increasing the font size?
2.There is a scrollbar setting in CardSettings which when set to Horizontal, makes the grid to span rows horizontally when the number rows increases. I am looking for something like Vertical so that a scrollbar will appear vertically and rows spans vertically, do you know any way of doing this?