We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Calculated properties not updated correctly

I have a BindingList, which is the datasource for a BindingSource. This BindingSource is the datasource for a grid.

The 'Person' class implements INotifyPropertyChanged, and includes a get/set 'Date' property. In the setter, PropertyChanged() is fired for another property, "IsEvenYear". The IsEvenYear property is a readonly bool, which returns whether 'Date' is an even-numbered year.

The problem is that the IsEvenYear column checkbox only updates to the correct value after moving to a new row. In other grids (including .Net DataGridView) the checkbox updates correctly as soon as another column on the same row is selected (e.g. by pressing Tab).

Can you please advise how to avoid this problem?

2 Replies

AD Administrator Syncfusion Team December 18, 2006 11:17 AM UTC

I forget to mention - the grid class we are using is GridDataBoundGrid. We will also need to be able to do this in a GridGroupingControl.


AD Administrator Syncfusion Team December 18, 2006 12:10 PM UTC

Hi Jeremy,

For DataBoundGrid :

To push all data to underlying datasource for every cell movement, you need to call in Binder.EndEdit Method(before calling this , you need to call the CurrentCell''s Edit method) in the CurrentCellMoving event of the grid. Here is a code snippet.

//CurrentCellMoving event.
this.grid.CurrentCell.EndEdit(); //saves the currentcell
this.grid.Binder.EndEdit(); //removes the pencil

For GridGroupingGrid:

You can handle the TableControlCurrentCellMoving event and call the Table.EndEdit() method. Here is a code snippet.

e.TableControl.CurrentCell.EndEdit(); //saves the currentcell
e.TableControl.Table.EndEdit();

Let me know if this helps.
Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon