Hi I have a ultraGrid and using datasource to bound as
grid.SetDataBinding(List , null, true);
If any addition or updating the list I am using like
_list.Add(newItem) ;
_view.List = _list;
My problem is if I scroll the grid down and add or update the list scroll is going to top which I dont want.
I have UltraTree and behaving the same .
I want not to move the scroll position until user move it.
Please advise.
Old thread, but I just had this problem when using e.Cell.Row.Update() (or any other UpdateData() type function on the Grid) from CellChange.
To fix it, I've stored m_FirstRow = xx.FirstRow, then set the FirstRow in AfterRowScrollRegion, then immediately setting it to null (or you can't manually scroll).
Hope this helped someone else!
Thanks for the prompt and quick response. It is working now.
Well, you need a way to compare entities. In my project each entity has an ID which is the primary key.
1. In AfterRowActivate event, save the row ID somewhere.
2. In AfterRowRegionScroll, save the ID of e.RowScrollRegion.FirstRow
3. After you set the data again, search for the row with the ID in (1) and call row.Activate().
4. and, search for the row with the ID in (2) and set: grid.DisplayLayout.RowScrollRegions[0].FirstRow = row.
Hi I am binding Business Object list to datasorce. My business object is not implementing IBindigList.So binding source not working.
Please could you give me the solution to the existing written code . Since we dont have time to go back we can't change our code now.
Thanks
Actually I wrote a code to maintain the scroll position and active row after binding reset, but I think you're doing something wrong here. You don't need to bind your list again on any change. That's what binding is all about. You should use a BindingSource as your grid data source and set the list as the data source of the BindingSource, or use a BindingList instead. These types know to handle grid update when there is a change without losing the scroll position, unless their data source (your list) has been reset (which is why I wrote my code to maintain the scroll).