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
300
Draw column borders in GroupByRows
posted

I've seen similar threads, but not this exact problem. I'm trying to draw the column borders in my GroupByRows so they look like data rows in the grid. 

I'm using the SummaryCells display style to align Summaries with Columns. 

this.DisplayLayout.Override.GroupBySummaryDisplayStyle = Infragistics.Win.UltraWinGrid.GroupBySummaryDisplayStyle.SummaryCells;

For columns with summaries this works great and I can easily draw borders using the DrawFilter. The problem is for columns that don't have summaries.

My current approach is to use a DrawFilter to draw a line from the Header all the way across the grid. I'm using the AfterDrawForegroundPhase for the HeaderUIElement, but my lines seem to be getting drawn over by the body of the grid. (See code and screen shot below. Lines are in red, blue rows are GroupByRows).

Is there a better phase/UIElement to use? A different approach altogether? My other thought is to attach a custom summary to all columns that does nothing, just so I can draw its borders. That seems like a waste though.

Thanks,
Stefan

In GetPhasesToFilter:

else if (drawParams.Element is HeaderUIElement)
                return DrawPhase.AfterDrawForeground;

 

In DrawElement

else if (drawParams.Element is HeaderUIElement)
            {
               int gridBottom = drawParams.Element.ControlElement.RectInsideBorders.Bottom;

                // Draw column borders through the entire grid
 drawParams.Graphics.DrawLine(System.Drawing.Pens.Red, new Point(drawParams.Element.RectInsideBorders.X - 2, drawParams.Element.Rect.Y),
new Point(drawParams.Element.RectInsideBorders.X - 2, gridBottom));
            }