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
455
Maintain Active Row and Scroll Position between Grid Refresh
posted

Hi,

I have a win grid which is bound to list of custom application object (MarketDataItem), after every minute the data is re read from the application and bound to grid again. Also before refresh the I store the current  active row and scroll position and after the refresh I set them but this produces a flicker effect on the grid, is there a better way to do this?

 int keyField;

int scrollPosition;

UltraGridRow lastActiveRow;

keyField = (grid.ActiveRow.ListObject as MarketDataItem).Key;

scrollPosition = grid.ActiveRowScrollRegion.ScrollPosition;

lastActiveRow=null;

grid.SetDataBinding(getData(), null, true, true);

if (lastActiveRow != null){

grid.ActiveRow = this.lastActiveRow ;

}

grid.ActiveRowScrollRegion.ScrollPosition = scrollPosition;

 

private void grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
 {
            MarketDataItem item = e.Row.ListObject as MarketDataItem;
            if (item != null)
            {
                if ( item.key == this.keyField )
                {
                    this.lastActiveRow = e.Row;
                }
            }

}

 

Also I have seen many responses where the suggested answer is not to rebind the data to the grid, but can some one suggest how can I program the above code so that I don't need to rebind. (One of the field lastPrice in the MarketDataItem object changes betwen each refresh so basically all the rows changes between each refresh). A small sample would really be appreciated.

 

Parents Reply Children