Invisible Rows Scrolling Fix

Dec 7, 2011 at 9:47 PM

Hello SourceGrid enthusiasts,

I just tweaked the grid slightly to fix an issue I was having, and I thought I'd share my fix in case anyone else finds it useful. It is very quick, dirty and hacky, but it certainly did the trick for me (I didn't have much time to make it any nicer).

I was finding that Grid.Rows.Clear() was not resetting the HiddenRowsCoordinator, so I was getting all kinds of scrolling problems when clearing the rows, and populating new rows, etc.

in RowsBase.cs, Class "RowsBase", I added a small function (I'm a VB guy so pardon my terms): 

public void ResetHiddenRowsCoordinator() {
     m_HiddenRowsCoordinator = new StandardHiddenRowCoordinator(this); 
}

 

Then, in RowInfoCollection.cs, at the end of the Clear() method, I call my function:

public void Clear(){
     if (Count == 0)
          return;
     this.Grid.LinkedControls.Clear();
     RemoveRange(0, Count);

     ResetHiddenRowsCoordinator();
}
 This way, when I call Rows.Clear(), the HiddenRowsCoordinator resets and all is wonderful in the world of scrolling.
I hope this helps someone out

Coordinator
Dec 8, 2011 at 10:52 AM

Could you please clone the official repo https://bitbucket.org/dariusdamalakas/sourcegrid/overview  and send a pull request, so that we could integrate your fix?