internal void OnItemRemoved(DataGridItemRemovedEventArgs e)
 {
     if (this.ItemRemoved != null)
     {
         this.ItemRemoved(this, e);
     }
 }
    public virtual void Remove( object item )
    {
      if( !this.CanRemove )
        throw new InvalidOperationException( "An attempt was made to remove an item from a source that does not support removal." );

      if( this.IsEditingItem || this.IsAddingNew )
        throw new InvalidOperationException( "An attempt was made to remove an item while an item is being edited or added." );

      int sourceIndex = -2;

      if( ( !this.HasSource ) || ( !this.IsSourceSupportingChangeNotification ) )
        sourceIndex = this.IndexOfSourceItem( item );

      DataGridRemovingItemEventArgs removingItemEventArgs = new DataGridRemovingItemEventArgs( this, item, -1, false );
      this.RootDataGridCollectionViewBase.OnRemovingItem( removingItemEventArgs );

      if( removingItemEventArgs.Cancel )
        throw new DataGridException( "Remove was canceled." );

      if( !removingItemEventArgs.Handled )
      {
        if( !this.HasSource )
          throw new InvalidOperationException( "The RemovingItem event must be handled when not using an underlying data source." );

        if( sourceIndex == -2 )
          sourceIndex = this.IndexOfSourceItem( item );

        if( sourceIndex != -1 )
          this.InternalRemoveAt( sourceIndex );
      }

      if( ( !this.HasSource ) || ( !this.IsSourceSupportingChangeNotification ) )
      {
        DeferredOperation deferredOperation = new DeferredOperation(
          DeferredOperation.DeferredOperationAction.Remove,
          sourceIndex,
          new object[] { item } );

        this.ExecuteOrQueueSourceItemOperation( deferredOperation );
      }

      DataGridItemRemovedEventArgs itemRemovedEventArgs = new DataGridItemRemovedEventArgs( this, item, -1 );
      this.RootDataGridCollectionViewBase.OnItemRemoved( itemRemovedEventArgs );
    }
    internal void OnItemRemoved( DataGridItemRemovedEventArgs e )
    {
      if( this.ItemRemoved != null )
        this.ItemRemoved( this, e );

      if( m_parentCollectionViewSourceBase != null )
        m_parentCollectionViewSourceBase.OnItemRemoved( e );
    }
 internal void OnItemRemoved( DataGridItemRemovedEventArgs e )
 {
   if( this.ItemRemoved != null )
     this.ItemRemoved( this, e );
 }