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
70
set Bottom border for UltraGrid Header
posted

Hi there,

I want the header of my UltraGrid to have a border only on the bottom

First I tried by Implementing the IUIElementDrawFilter and in the Draw Element function, I managed to draw a bottom line for my header. But the line is having weird behavior. If I point my cursor at the header, It sort of disappears and when I click on the header the line appears (kindly see the attached video below) 

Then I tried implementing the IUIElementCreationFilter Interface and inside the AfterCreateChildElements function I check if the UI Element is HeaderUIElement so that I can set the BorderStyle and BorderSides properties but this throws me an “Specified method is not supported.” error. 

Here is the Link (https://www.transferxl.com/04jYdDShFBDnYj) for my project with the exact code I wrote for both interfaces (IUIElementDrawFilter and IUIElementCreationFilter)

Kindly look into this and help me in this regard 

Regards.

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi, 

    Applying a border to one side of an object is very tricky. Many UIElements in the grid overlap each other and only draw one or 2 border sides by default. This is to avoid double-thick borders between objects. For example, if every cell in the grid drew all 4 border sides, then there would be a 2-pixel thick border around every cell. So it's likely that's why your DrawFilter is having issues - the first row UIElement probably overlaps the headers and so when you mouse over the row, the drawing of the row wipes out your extra border on the headers. 

    There are ways around that... you could use a CreationFilter to reduce the height of the headers so that there is no overlap. Or you might be able to use RowSpacingBefore on the first row of the grid to introduce some space there. But neither of these are ideal, since the former might clip something in the header and the latter could be tricky if the row order changes due to filtering and/or sorting. 

    If all you want to do is introduce some space or a separator under the header but before the first row in the grid, then there's a much simpler way to do that: 

            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                var layout = e.Layout;
                var ov = layout.Override;
    
                ov.SpecialRowSeparator = SpecialRowSeparator.All;
                ov.SpecialRowSeparatorAppearance.BackColor = Color.Red;
            }

Reply Children
No Data