I am able to get the visible rows in the grid, but how do I get the visible columns? I am only interested in the columns that are visible in the active scroll region, not anthing that is out of view.
You can get that list through the property called ActiveColScrollRegion. Here's a quick snippet showing it in action.
ColScrollRegion csr = this.ultraGrid1.ActiveColScrollRegion; foreach (VisibleHeader vh in csr.VisibleHeaders) { MessageBox.Show(vh.Header.Caption); }
I tried using your suggestion. The VisibleHeaders seem to be GroupHeaders. From that I have to get all the columns in the group and loop through them, checking the GetUIElement on each of them as I loop. This works, but it seems like there should be a more efficient way to get the visible columns. Am I missing something?
Hello,
There is some code at the following location in our documentation that prints out all of the visible columns whenever the grid is scrolled horizontally. It should help you do what you want.
http://help.infragistics.com/NetAdvantage/WinForms/2010.3/CLR2.0/?page=Infragistics2.Win.UltraWinGrid.v10.3~Infragistics.Win.UltraWinGrid.VisibleHeader.html
Hi Dave.
I saw that code and modeled my code after it. Unfortunately, it seems like I have to work my way down through visible headers, headers, groups and columns before I can get the column's key and see if the cell has a UIElement.
I am using the InitializeRow event of the grid and trying to optimize the code. My app uses that event heavily and the grid has gotten a little sticky. I was hoping to find a Columns collection on the VisibleScrollRegion, but this will work for now.
Thanks!
Rich