Shanthosh Siva

Shanthosh Siva

  • NA
  • 107
  • 15.4k

Two observal collection to remove an item

Mar 16 2019 2:18 AM
I have a two view model, if i want to delete a item in one model it may affect another model but both having same id..
 
Using two observal collection i want to remove item with same id's.
 
Note: C# Code 
private void WindowSize_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
if (WindowSize[e.NewStartingIndex].WindowSizeId == 0)
WindowSize[e.NewStartingIndex].WindowSizeId = WindowSize.Max(x => x.WindowSizeId) + 1;
WindowSize[e.NewStartingIndex].PropertyChanged += WindowSettingProjectViewModel_PropertyChanged;
}
else if(e.Action==NotifyCollectionChangedAction.Remove)
{
////HERE i want to write a code by matching two collection to  with same ID 
}
}
 
 
 
 

Answers (3)