I will need to perform a scroll of the grid (right or left) without navigation through the cells. What I am trying to do is marked the group headers rows (using the backcolor) and when reaching the last visible cell in the grid I will like to scroll it. I will need to determine somehow that I have reach the last visible cell and maybe PerformAction(scroll)?? Is there a way to get the last group header/column visible and scroll it via PerfomrAction?
Thanks,
Mihail
What event are you using to check for the existance of the column header UIElement?
I would have though the Refresh would work. But if not, you might have to be more aggressive about forcing the grid to rebuild the UIElement structure. You could try something like:
grid.UIElement.DirtyChildElements(true)
grid.Invalidate()
grid.UIElement.VerifyChildElements()
grid.Refresh()
If that works, it is probably overkill and you can try removing some of those lines of code to see what combination you need.
If it doesn't work, then I'm not sure if what you want to do here is possible. You might need to use a different event, or it just may not be doable.
In both cases (either Refresh or VerifyChildElements) I am getting the same null for headers.GetUIElement() calls.
If the UIElement is still returning null for columns that are actually visible on the screen, the my guess is that you are doing the check synchronously and the grid hasn't had time to paint. So maybe if you call Refresh on the grid or maybe grid.DisplayLayout.UIElement.VerifyChildElements, you can force the creation of the elements before you check them.
Hi Mihail,
I'm still not sure what the question / problem is. Everything you descrive here sounds correct.
In GetRelatedVisibleColumn, Visible means that the column is not hidden. It does not mean visible on the screen. If yuo want to check if the column is actually visible on the screen, then that's pretty tricky. You would have to use UIElement. You might be able to just check if the column.Header.GetUIElement method returns null, maybe.