Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
384
Change Expand\Collapse Image in Card View
posted

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

Parents
No Data
Reply
  • 10880
    Verified Answer
    posted

    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.

Children