Hi,
I have a ultraGrid that binds to a BindingSoruce. The BindingSource binds to a dataset.
BindingSource m_bindingSource = new BindingSource(dataset, "myTable");
m_ultraGrid.DataSource = bindingSource;
I also have a text box that showing one of the row's column value in "myTable". We use our own custom binding in this case so that when the text box value change, it updates the column for the corresponding row directly. (i.e. dataSet.myTable["columnName"] = updatedValue);
The ultraGrid immediately shows any changes if the anything changes in "myTable", that's works great.
Now, I would like ultraGrid not to reflect any changes until the dataSource is all updated.
I tried using one or combination of the following:
1. m_ultraGrid.BeginUpdate();
2. m_ultraGrid.SuspendRowSynchronization();
3. m_bindingSource.SuspendBinding();
I looked up on SuspendRowSynchronization and bindingSource.SuspendBinding which I don't think I am using it right. However, it seems like m_ultraGrid.BeginUpdate() should prevent grid showing reflect changes from the binding source.
Is it possible to defer the ultraGrid update when the bindingSource changes? If so, how to do that?
In my design, user can't interact with the gird until they finish complete editing the dataSource.
All these interaction is done in the UI thread.
Thanks
Check out the WinGrid Performance Guide.
In particular, the section on Painting has some sample code that shows the proper way to perform multiple operations on the data source and prevent the grid from responding to each notification synchronously.
I had already tried to use the BeginUpdate() and the SuspendRowSynchronization(), for some reasons it doesn't work. Is there any properties I have to set to ensure these functions work?
Also, I checked the sample app "Bound To Various Control". I changed the default WinForm.Grid with UltraWinGrid, the only two different I found compare the sample and my application is:
a. It bounds to ultraDataSource, instead of ADO.NET Dataset
b. It uses SetDataBinding() method, instead of assigning the DataSource to a BindingSource that has the dataset.
Does the BeginUpdate works for Dataset binding, or it only works for UltraDataSource?
[Update] - I wrote a sample app, and ultra grid also works for dataset.
[Update] - It looks like the WinGrid.IsUpdating helps me to identify when it get set to false.
Other than EndUpdate(), is there other method that could get the IsUpdating back to false?
[Solved]
As it turns out our custom control has a self refreshing timer that calls the a refresh method which ended up calling EndUpdate() whenever the Dataset changes.This timer is used for refresh grid that are not bound to a data source.
In summary, the BeginUpdate() and EndUpdate() are working as expected.
Thanks for the help