I am using Binding List in my application along with ItemChanged event.
Is there any way I could know the previous values of properties in ItemChanged event. Curren
Actually, deletion happens before the event fires. So, you cannot get to the item being removed. You definitely need some additional logic for that You can, however, inherit from BindingList, and override RemoveItem:
public class RemoveAndBind : BindingList
{
protected override void RemoveItem(int index)
{
if (FireBeforeRemove != null)
FireBeforeRemove(this,new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
base.RemoveItem(index);
}
public event EventHandler FireBeforeRemove;
}
Replicate the BindingList constructors. Don't make it cancellable to avoid misconceptions. You may also find some help here: http://connect.microsoft.com/VisualStudio/feedback/details/148506/listchangedtype-itemdeleted-is-useless-because-listchangedeventargs-newindex-is-already-gone
Hope this helps.