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
805
Entity value changes, but
posted

I have an IList of entities bound to my UltraWinGrid. The entity has several get's that return calculated values. These values have to be provided by the user, which they do in a pair of UltraNumericEditors. In order to keep the API as simple as possible, when the user enters these values and presses a button, I copy the values out of the fields and into ivars in the entiries. The get's read those and return the right values.

The numbers are working fine, but the Grid display is not. Unless you take an action that causes a repaint, the cells retain their old values. Little is needed to make them refresh, even mousing over the cells or scrolling will do it.

Since the calculated values are the ones in the Grid, and the ivars are not (normally at least), I put NotifyPropertyChanged calls on the three calculated get's in the set's on the ivars. I thought that would cause the Grid to notice that it had to refresh those columns, but that didn't help.

Any ideas? If nothing else, is there a repaint method I should use?

 

Parents
  • 469350
    Suggested Answer
    Offline posted

    The problem here is that IList is not a very robust interface for DataBinding. When you make a change to one of you entities, the IList cannot detect this automatically and does not send a notification to the grid that the data has been changed. So the grid does not know to refresh itself.

    I recommend using a BindingList<T>, instead of an IList for DataBinding.You may also need to implement INotifyPropertyChanged on your entity class.

    Or... if you just want to refresh the grid in code, you can call:

    grid.Rows.Refresh(ReloadData)

     

Reply Children