//---------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
namespace ExtendedGrid.Microsoft.Windows.Controls
{
///
/// Communicates which cells were added or removed from the SelectedCells collection.
///
public class SelectedCellsChangedEventArgs : EventArgs
{
///
/// Creates a new instance of this class.
///
/// The cells that were added. Must be non-null, but may be empty.
/// The cells that were removed. Must be non-null, but may be empty.
public SelectedCellsChangedEventArgs(List addedCells, List removedCells)
{
if (addedCells == null)
{
throw new ArgumentNullException("addedCells");
}
if (removedCells == null)
{
throw new ArgumentNullException("removedCells");
}
_addedCells = addedCells.AsReadOnly();
_removedCells = removedCells.AsReadOnly();
}
///
/// Creates a new instance of this class.
///
/// The cells that were added. Must be non-null, but may be empty.
/// The cells that were removed. Must be non-null, but may be empty.
public SelectedCellsChangedEventArgs(ReadOnlyCollection addedCells, ReadOnlyCollection removedCells)
{
if (addedCells == null)
{
throw new ArgumentNullException("addedCells");
}
if (removedCells == null)
{
throw new ArgumentNullException("removedCells");
}
_addedCells = addedCells;
_removedCells = removedCells;
}
internal SelectedCellsChangedEventArgs(DataGrid owner, VirtualizedCellInfoCollection addedCells, VirtualizedCellInfoCollection removedCells)
{
_addedCells = (addedCells != null) ? addedCells : VirtualizedCellInfoCollection.MakeEmptyCollection(owner);
_removedCells = (removedCells != null) ? removedCells : VirtualizedCellInfoCollection.MakeEmptyCollection(owner);
Debug.Assert(_addedCells.IsReadOnly, "_addedCells should have ended up as read-only.");
Debug.Assert(_removedCells.IsReadOnly, "_removedCells should have ended up as read-only.");
}
///
/// The cells that were added.
///
public IList AddedCells
{
get { return _addedCells; }
}
///
/// The cells that were removed.
///
public IList RemovedCells
{
get { return _removedCells; }
}
private IList _addedCells;
private IList _removedCells;
}
}