> I have created a custom collection class which inherits from
> CollectionBase class and implements the IBindingList
> interface. I am having a problem regarding adding a new
> record and form binding. When I add a new record by calling
> the AddNew() method on the CurrencyManager class instance,
> the screen does not get refreshed. When I tried to figure out
> the problem, I found that the position of the CurrnecyManager
> does not change, and it does not fire the PositionChanged
> event. I figured that the
> CurrnecyManager.AddNew() method calls the
> IBindingList.AddNew() and it internally calls the
> ChangeRecordState() method. By looking at the call stack, I
> see that the newPosition argument passed to
> ChangeRecordState() method is correct and it raises the
> CurrentChanged event whereas the PositionChanged event does
> not get fired and the UI is not updated.
>
> When I move the record position by incrementing or
> decrementing the Positon property, the UI controls does get
> updated normally but not in the case of
> AddNew() i.e.
>
> _cm.Position = _cm.Count-1;
>
> also does not work
>
> Your inputs on this would be highly appreciated
You should raise ListChanged events in your class. You should pass the
index of the item changed/ added/ removed as well as
the type of the change in the eventargs.
Frans
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com