Hey Folks -
I have been unsuccessful in getting borders to draw around specific rows within a hierarchical grid based on a specific row value. I am needing to draw different border types around individual rows, so i assumed that I would be working with the UIElement. But as I have learned and also confirmed through posts, that the UIElement is not available at a row level. I have also tried a DrawFilter, and that ends up being a complete mess. So....
My question is "How do you draw different types of borders around individual rows within a hierarchical grid display based on some row value?"
I have really looked through the forums and even tried Infragistics Support (2 weeks and running now), but I am just not making progress on this issue like I need to. So if anyone has solved this problem before or has seen a post, please let me know.
Super Big Thanks! ~Eric
Hello Eric,
I looked up your case and noticed that the Developer Support Engineer it was assigned to gave you some suggestions. I'm posting them here so other users with the same question can find them. Did any of them help you?
-- Begin pasted content --
The rectangle that we created is a property of the UIElement. It is not itself a UIElement, which does have Border styles. What we did was draw a rectangle over top of the cells.
There are some properties of the Rectangle that you might be able to exploit. And the borderPen would allow you to customize the border style.
Here are some links that should provide some background.
http://help.infragistics.com/NetAdvantage/WinForms/2010.2/CLR2.0/?page=Infragistics2.Win.v10.2~Infragistics.Win.UIElement_members.html
http://help.infragistics.com/NetAdvantage/WinForms/2010.2/CLR2.0/?page=Infragistics2.Win.v10.2~Infragistics.Win.UIElementDrawParams_members.html
Dave -
Thanks for including that information for other users to reference as well. Sadly, the answer is no, I could not get it to work in the hierarchical display, which is odd considering that it should make no difference if it is a top level row versus a 4th level. But regardless of the levels, I could never get any advanced borders drawn.
If you would follow those links listed above, you see they reference the UIElement, which is NOT available to me at the row level. So I am probably missing something simple and obvious. Unfortunately at this point, I am understanding (but hopefully I am wrong) that Infragistics suggests that I use the UIElement but the UIElement is not available to me at the row level, so the suggestion is not helpful based on what I am understanding.
So I have tossed it to the forums with a hope that whatever I am missing can be more easily pointed out. I am seriously bummed that I could make no progress with any other support approach :(
-Eric
Hi Eric,
If you want a space between the rows, then you can do that using the RowSpaceBefore and/or RowSpacingAfter properties. In that case, drawing borders around the rows would become much easier, since there would be no overlapping.
But I would still take the approach of using the DrawFilter with the AfterDrawElement phase of the parent element containing the rows (RowColRegionIntersectionUIElement, if I am not mistaken).
Mike -
Thank you for the feedback. I am aware that with the Infragistics grid, that this particular effort is challenging. My thought has been that there are space assignments between the rows. This space assignment should be separate from the space that is allocated to borders for each row. In my testing, this has not been the case, which is why I get the effect that you describe which is one row overlays the other. I had resolved this by doing a check, but the whole thing became buggy and seemed to create a circular draw effect where one change was affecting the redraw (probably something silly in my code).
But I understand your feedback and will consider your answer as the final word on the subject. I have access to other 3rd party controls to use in this case... I just really like the Infragistics controls :)
Best Wishes
What you are trying to do he is very difficult and complex. There are a couple of reasnos for this.
1) The rows in the grid are mostly covered by the cells within the row.
2) Rows and cells in the grid almost never draw all 4 sides of their own borders, because if they did, you would end up with a double-thick border in between every cell.
If you think about it, drawing a border around more than one row in the grid does not even make sense. Suppose you draw a red border around one row and a blue border around the row adjacent to it? What should happen where they intersect? Do you want to see both borders? If so, then one of those borders will have to be inside the row.
If you want to highlight a row in some way, I recommend using the BackColor/ForeColor of the row instead of a border. This will be much easier.
But, if you really need to draw borders on the row, then you can do this with UIElements. I don't know what you mean when you say that the row UIElement is not available to you. Rows in the grid absolutely do have UIElements associated with them.
Anyway, the way to do something like this would be to use a DrawFilter and handle the AfterDrawElement of the UIElement which contains the rows and then find the RowUIElements within that element and use those elements to examine the rows themselves and determine what to draw and where to draw it. By using AfterDrawElement on the parent element, you can ensure that whatever you draw is drawn on top of the existing rows and cells, so it will cover any borders that are already being drawn for those objects.