//------------------------------------------------------------------------------
// <copyright file=”*.cs” company=”EhLib Team”>
//     Copyright (c) 2017 Dmitry V. Bolshakov   
// </copyright>
//------------------------------------------------------------------------------

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace EhLib
{

  //Delegates
  public delegate void DataGridEventHandler(object sender, EventArgs e);

  public delegate void DataGridDataCellEventHandler(object sender, DataGridDataCellEventArgs e);

  public delegate void DataGridDataCellMouseEventHandler(object sender, DataGridDataCellMouseEventArgs e);
  public delegate void DataGridColumnDataCellMouseEventHandler(object sender, DataGridDataCellMouseEventArgs e);

  public delegate void DataGridDefaultContextMenuStripNeededEventHandler(object sender, DataGridDefaultContextMenuStripNeededEventArgs e);
  public delegate void DataGridRowIsSelectableEventHandler(object sender, DataGridRowIsSelectableEventArgs e);

  public delegate void DataGridSearchBoxCheckRowHitSearchEventHandler(object sender, DataGridSearchBoxCheckRowHitSearchEventArgs e);
  public delegate void DataGridSearchBoxCheckCellHitSearchEventHandler(object sender, DataGridSearchBoxCheckCellHitSearchEventArgs e);
  public delegate void DataGridSearchGetHighlightedRangesEventHandler(object sender, DataGridSearchGetHighlightedRangesEventArgs e);

  public delegate void DataGridDataCellObjectNeededEventHandler(object sender, DataGridDataCellObjectNeededEventArgs e);

  public delegate void DataGridRowHeightQueryingEventHandler(object sender, DataGridRowHeightQueryingEventArgs e);

  public delegate void DataGridHorzLineParamsNeededEventHandler(object sender, DataGridHorzLineParamsNeededEventArgs e);

  //DataGrid...EventArgs classes
  public class DataGridHorzLineParamsNeededEventArgs : EventArgs
  {
    private readonly DataGridColumn column;
    private readonly DataGridRow row;

    public DataGridHorzLineParamsNeededEventArgs(DataGridColumn column, DataGridRow row)
    {
      this.column = column;
      this.row = row;
    }

    public DataGridColumn Column
    {
      get { return this.column; }
    }

    public DataGridRow Row
    {
      get { return this.row; }
    }

    public bool Visible { get; set; }

    public Color Color { get; set; }

    public DashStyle Style { get; set; }

  }

  public class DataGridDataCellObjectNeededEventArgs : EventArgs
  {
    private readonly DataGridColumn column;
    private readonly DataGridRow row;
    private BaseGridCellManager cellObject;

    public DataGridDataCellObjectNeededEventArgs(DataGridColumn column, DataGridRow row)
    {
      this.column = column;
      this.row = row;
    }

    public DataGridColumn Column
    {
      get { return this.column; }
    }

    public DataGridRow Row
    {
      get { return this.row; }
    }

    public BaseGridCellManager CellObject
    {
      get { return this.cellObject; }
      set { cellObject = value; }
    }

  }

  public class DataGridDataCellPaintEventArgs : DataAxisGridDataCellPaintEventArgs
  {
    public DataGridDataCellPaintEventArgs(BaseGridCellManager cellManager, Graphics graphics, int colIndex, int rowIndex,
      Rectangle cellRect, BasePaintCellStates state, int areaColIndex, int areaRowIndex, Point inCellMousePos,
      PropertyAxisBar propAxisBar, object listItemBar)
      : base(cellManager, graphics, colIndex, rowIndex, cellRect, state, areaColIndex, areaRowIndex, inCellMousePos, propAxisBar, listItemBar)
    {
    }

    public void Reset(Graphics graphics, int colIndex, int rowIndex, Rectangle cellRect,
      BasePaintCellStates state, int areaColIndex, int areaRowIndex, DataGridColumn column, DataGridRow row,
      Point inCellMousePos)
    {
      throw new NotImplementedException();
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }

  }

  public class DataGridDataCellContentPaintEventArgs : EventArgs
  {
    private readonly DataGridDataCellPaintEventArgs dataCellPaintEventArgs;
    private readonly Rectangle cellContentRect;

    public DataGridDataCellContentPaintEventArgs(DataGridDataCellPaintEventArgs dataCellPaintEventArgs, Rectangle cellContentRect)
    {
      this.dataCellPaintEventArgs = dataCellPaintEventArgs;
      this.cellContentRect = cellContentRect;
    }

    public DataGridDataCellPaintEventArgs DataCellPaintEventArgs
    {
      get { return this.dataCellPaintEventArgs; }
    }

    public Rectangle CellContentRect
    {
      get { return this.cellContentRect; }
    }

    public DataGridColumn Column
    {
      get { return dataCellPaintEventArgs.Column; }
    }

    public DataGridRow Row
    {
      get { return dataCellPaintEventArgs.Row; }
    }

    public BasePaintCellStates State
    {
      get { return dataCellPaintEventArgs.State; }
    }

    public Graphics Graphics
    {
      get { return dataCellPaintEventArgs.Graphics; }
    }

    public int DataColIndex
    {
      get { return dataCellPaintEventArgs.DataColIndex; }
    }

    public int DataRowIndex
    {
      get { return dataCellPaintEventArgs.DataRowIndex; }
    }
  }

  public class DataGridDataCellMouseEventArgs : DataAxisGridDataCellMouseEventArgs
  {

    public DataGridDataCellMouseEventArgs(
      BaseGridCellManager cellManager,
      int colIndex, int rowIndex,
      int areaColIndex, int areaRowIndex,
      PropertyAxisBar propAxisBar, object listItemBar,
      int inCellX, int inCellY,
      Rectangle cellRect,
      MouseEventArgs e) : base(cellManager, colIndex, rowIndex, areaColIndex, areaRowIndex, propAxisBar, listItemBar, 
        inCellX, inCellY, cellRect, e)
    {
    }

    public DataGridDataCellMouseEventArgs(
      BaseGridCellManager cellManager,
      BaseGridCellMouseEventArgs baseArgs,
      int areaColIndex, int areaRowIndex,
      PropertyAxisBar propAxisBar, object listItemBar) :
        base(cellManager, baseArgs, areaColIndex, areaRowIndex, propAxisBar, listItemBar)
    {
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridColumnEventArgs : EventArgs
  {
    private readonly DataGridColumn column;

    public DataGridColumnEventArgs(DataGridColumn column)
    {
      this.column = column;
    }

    public DataGridColumn Column
    {
      get { return this.column; }
    }
  }

  public class DataGridDisplayColumnsMovedEventArgs : EventArgs
  {
    DataGridColumn[] movedColumns;
    int toIndex;
    DataGridColumn afterColumn;

    public DataGridDisplayColumnsMovedEventArgs(DataGridColumn[] movedColumns, int toIndex, DataGridColumn afterColumn)
    {
      this.movedColumns = movedColumns;
      this.toIndex = toIndex;
      this.afterColumn = afterColumn;
    }

    public DataGridColumn[] MovedColumns
    {
      get { return this.movedColumns; }
    }

    public int ToIndex
    {
      get { return this.toIndex; }
    }

    public DataGridColumn AfterColumn
    {
      get { return this.afterColumn; }
    }
  }

  public class DataGridColumnCellEventArgs : BaseGridCellEventArgs
  {
    private readonly DataGridColumn column;

    public DataGridColumnCellEventArgs(int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect, DataGridColumn column) :
      base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect)
    {
      this.column = column;
    }

    public DataGridColumnCellEventArgs(BaseGridCellEventArgs baseArgs, DataGridColumn column) :
      base(baseArgs.ColIndex, baseArgs.RowIndex, baseArgs.AreaColIndex, baseArgs.AreaRowIndex, baseArgs.CellRect)
    {
      this.column = column;
    }

    public DataGridColumn Column
    {
      get { return this.column; }
    }

    public override string ToString()
    {
      return string.Format("ColIndex = {0} RowIndex = {1}",
        ColIndex, RowIndex);
    }
  }

  public class DataGridRowIsSelectableEventArgs : EventArgs
  {
    private readonly DataGridRow dataRow;

    public DataGridRowIsSelectableEventArgs(DataGridRow dataRow)
    {
      this.dataRow = dataRow;
    }

    public DataGridRow DataRow
    {
      get { return dataRow; }
    }

    public bool RowIsSelectable { get; set; }
  }

  public class DataGridDataCellEventArgs : DataAxisGridDataCellEventArgs
  {
    public DataGridDataCellEventArgs(int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect,
      PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell) :
      base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect, propAxisBar, listItemBar, cell)
    {
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridDataCellEnterEventArgs : DataAxisGridDataCellEnterEventArgs
  {
    public DataGridDataCellEnterEventArgs(int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect, int leaveColIndex, int leaveRowIndex,
      PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell)
      : base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect, leaveColIndex, leaveRowIndex, propAxisBar, listItemBar, cell)
    {
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridDataCellLeaveEventArgs : DataAxisGridDataCellLeaveEventArgs
  {
    public DataGridDataCellLeaveEventArgs(int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect, int enterColIndex, int enterRowIndex,
      PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell)
      : base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect, enterColIndex, enterRowIndex, propAxisBar, listItemBar, cell)
    {
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridTitleCellMouseEventArgs : HandledEventArgs
  {
    private readonly DataGridColumn column;
    private readonly DataGridColumnTitle columnTitle;
    //private readonly DataGridSuperTitle superTitle;
    private readonly BaseGridCellMouseEventArgs baseEventArgs;
    private readonly int inCellX;
    private readonly int inCellY;
    private readonly Rectangle cellRect;

    public DataGridTitleCellMouseEventArgs(BaseGridCellMouseEventArgs baseArgs, DataGridColumn column,
      DataGridColumnTitle columnTitle, int inCellX, int inCellY,
      Rectangle cellRect)
    {
      this.baseEventArgs = baseArgs;
      this.column = column;
      this.columnTitle = columnTitle;
      //this.superTitle = superTitle;
      this.inCellX = inCellX;
      this.inCellY = inCellY;
      this.cellRect = cellRect;
    }

    public DataGridColumn Column
    {
      get { return this.column; }
    }

    public DataGridColumnTitle ColumnTitle
    {
      get { return this.columnTitle; }
    }

    //public DataGridSuperTitle SuperTitle
    //{
    //  get { return this.superTitle; }
    //}

    public BaseGridCellMouseEventArgs BaseEventArgs
    {
      get { return baseEventArgs; }
    }

    public int InCellX
    {
      get { return inCellX; }
    }

    public int InCellY
    {
      get { return inCellY; }
    }

    public Rectangle CellRect
    {
      get { return cellRect; }
    }
  }

  public class DataGridTitleCellEventArgs : HandledEventArgs
  {
    private readonly DataGridColumn column;
    private readonly DataGridColumnTitle columnTitle;
    private readonly DataGridSuperTitle superTitle;
    private readonly BaseGridCellEventArgs baseEventArgs;

    public DataGridTitleCellEventArgs(BaseGridCellEventArgs baseEventArgs, DataGridColumn column,
      DataGridColumnTitle columnTitle, DataGridSuperTitle superTitle)
    {
      this.baseEventArgs = baseEventArgs;
      this.column = column;
      this.columnTitle = columnTitle;
      this.superTitle = superTitle;
    }

    public DataGridColumn Column
    {
      get { return this.column; }
    }

    public DataGridColumnTitle ColumnTitle
    {
      get { return this.columnTitle; }
    }

    public DataGridSuperTitle SuperTitle
    {
      get { return this.superTitle; }
    }

    public BaseGridCellEventArgs BaseEventArgs
    {
      get { return baseEventArgs; }
    }
  }

  public class DataGridDefaultContextMenuStripNeededEventArgs : EventArgs
  {
    private ContextMenuStrip contextMenuStrip;

    internal DataGridDefaultContextMenuStripNeededEventArgs(ContextMenuStrip contextMenuStrip)
    {
      this.contextMenuStrip = contextMenuStrip;
    }

    public ContextMenuStrip ContextMenuStrip
    {
      get { return this.contextMenuStrip; }
      set { this.contextMenuStrip = value; }
    }
  }

  public class DataGridSearchBoxCheckRowHitSearchEventArgs : EventArgs
  {
    private readonly string hitSearchText;
    private readonly DataGridRow dataRow;

    public DataGridSearchBoxCheckRowHitSearchEventArgs(string hitSearchText, DataGridRow dataRow)
    {
      this.dataRow = dataRow;
      this.hitSearchText = hitSearchText;
    }

    public DataGridRow DataRow
    {
      get { return dataRow; }
    }

    public string HitSearchText
    {
      get { return hitSearchText; }
    }

    public bool RowIsHitSearch { get; set; }

  }

  public class DataGridSearchBoxCheckCellHitSearchEventArgs : EventArgs
  {
    private readonly string hitSearchText;
    private readonly DataGridRow dataRow;
    private readonly DataGridColumn dataColumn;

    public DataGridSearchBoxCheckCellHitSearchEventArgs(string hitSearchText, DataGridRow dataRow, DataGridColumn dataColumn)
    {
      this.dataRow = dataRow;
      this.dataColumn = dataColumn;
      this.hitSearchText = hitSearchText;
    }

    public string HitSearchText
    {
      get { return hitSearchText; }
    }

    public DataGridRow DataRow
    {
      get { return dataRow; }
    }

    public DataGridColumn DataColumn
    {
      get { return dataColumn; }
    }

    public bool CellIsHitSearch { get; set; }
  }

  public class DataGridSearchGetHighlightedRangesEventArgs : EventArgs
  {
    private readonly string hitSearchText;
    private readonly DataGridRow dataRow;
    private readonly DataGridColumn dataColumn;
    private readonly CharacterRange[] ranges;

    public DataGridSearchGetHighlightedRangesEventArgs(string hitSearchText, DataGridRow dataRow, DataGridColumn dataColumn, CharacterRange[] ranges)
    {
      this.dataRow = dataRow;
      this.dataColumn = dataColumn;
      this.hitSearchText = hitSearchText;
      this.ranges = ranges;
    }

    public string HitSearchText
    {
      get { return hitSearchText; }
    }

    public DataGridRow DataRow
    {
      get { return dataRow; }
    }

    public DataGridColumn DataColumn
    {
      get { return dataColumn; }
    }

    public CharacterRange[] Ranges
    {
      get { return ranges; }
    }
  }

  public class DataGridRowHeightQueryingEventArgs : EventArgs
  {
    private readonly DataGridRow row;

    public DataGridRowHeightQueryingEventArgs(DataGridRow row)
    {
      this.row = row;
    }

    public DataGridRow Row
    {
      get { return this.row; }
    }

    public bool Processed { get; set; }

    public int RowHeight { get; set; }
  }

  public class DataGridSetDataValueErrorEventArgs : EventArgs
  {
    private readonly Exception exception;
    private bool throwException;

    public DataGridSetDataValueErrorEventArgs(Exception exception)
    {
      this.exception = exception;
    }

    public Exception Exception
    {
      get
      {
        return this.exception;
      }
    }

    public bool ThrowException
    {
      get
      {
        return this.throwException;
      }
      set
      {
        if (value && this.exception == null)
        {
          throw new ArgumentException("Cannot Throw Null Exception");
        }
        this.throwException = value;
      }
    }
  }

  public class DataGridSuperTitleContentRectNeededEventArgs : EventArgs
  {
    private DataGridEh grid;
    private DataGridSuperTitle superTitle;
    private Rectangle contentRect;
    private Rectangle cellRect;

    public DataGridSuperTitleContentRectNeededEventArgs(DataGridEh grid)
    {
      this.grid = grid;
    }

    public DataGridEh Grid
    {
      get { return grid; }
    }

    public DataGridSuperTitle SuperTitle
    {
      get { return superTitle; }
    }

    public Rectangle CellRect
    {
      get { return cellRect; }
    }

    public Rectangle ContentRect
    {
      get { return contentRect; }
      set { contentRect = value; }
    }

    public void Reset(DataGridSuperTitle superTitle, Rectangle cellRect)
    {
      this.superTitle = superTitle;
      this.cellRect = cellRect;
    }
  }

  public class DataGridSuperTitleFittedHeightNeededEventArgs : EventArgs
  {
    private DataGridEh grid;
    private DataGridSuperTitle superTitle;
    private Rectangle cellRect;
    private int fittedHeight;

    public DataGridSuperTitleFittedHeightNeededEventArgs(DataGridEh grid)
    {
      this.grid = grid;
      fittedHeight = -1;
    }

    public DataGridEh Grid
    {
      get { return grid; }
    }

    public DataGridSuperTitle SuperTitle
    {
      get { return superTitle; }
    }

    public Rectangle CellRect
    {
      get { return cellRect; }
    }

    public int FittedHeight
    {
      get { return fittedHeight; }
      set { fittedHeight = value; }
    }

    public void Reset(DataGridSuperTitle superTitle, Rectangle cellRect)
    {
      this.superTitle = superTitle;
      this.cellRect = cellRect;
      fittedHeight = -1;
    }
  }

  public class DataGridDataCellFormatParamsEventArgs : DataAxisGridDataCellFormatParamsEventArgs
  {
    public DataGridDataCellFormatParamsEventArgs(int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect,
      PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell,
      DataAxisGridDataCellFormatApplying formatApplying)
      : base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect, propAxisBar, listItemBar, cell, formatApplying)
    {
      this.FormatApplying = formatApplying;
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridDataCellPullValueEventArgs : DataAxisGridDataCellPullValueEventArgs
  {

    public DataGridDataCellPullValueEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cellMan) 
      : base(propAxisBar, listItemBar, cellMan)
    {

    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridDataCellPushValueEventArgs : DataAxisGridDataCellPushValueEventArgs
  {

    public DataGridDataCellPushValueEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cellMan)
      : base(propAxisBar, listItemBar, cellMan)
    {

    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }

    public void PushValue(DataGridDataCellPushValueEventArgs e)
    {
      e.Column.OnPushValue(e);
    }
  }

  public class DataGridDataCellParseValueEventArgs : DataAxisGridDataCellParseValueEventArgs
  {

    public DataGridDataCellParseValueEventArgs(PropertyAxisBar propAxisBar, object listItemBar, 
      DataAxisGridDataCellMan cellMan, object inValue)
      : base(propAxisBar, listItemBar, cellMan, inValue)
    {

    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridCreatingDynamicColumnsForDataPropertyEventArgs : DataAxisCreatingDynamicColumnsForDataPropertyEventArgs
  {
    public DataGridCreatingDynamicColumnsForDataPropertyEventArgs(DataAxisGrid grid, PropertyDescriptor propertyDescriptor, bool inStaticColumns)
      : base(grid, propertyDescriptor, inStaticColumns)
    {
    }

    public bool InStaticColumns
    {
      get { return InStaticPropBars; }
    }

    public PropertyAxisBar[] Columns
    {
      get { return PropertyBars; }
      set { PropertyBars = value; }
    }

  }

  public class DataGridDataCellToolTipInfoEventArgs : DataAxisGridDataCellToolTipInfoEventArgs
  {

    public DataGridDataCellToolTipInfoEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cellMan)
      : base(propAxisBar, listItemBar, cellMan)
    {

    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridDataCellContextMenuStripNeededEventArgs : DataAxisGridDataCellContextMenuStripNeededEventArgs
  {

    public DataGridDataCellContextMenuStripNeededEventArgs(
      BaseGridCellManager cellManager, int colIndex, int rowIndex, int areaColIndex, int areaRowIndex,
      int inCellX, int inCellY, Rectangle cellRect, int MousePosX, int MousePosY,
      PropertyAxisBar propAxisBar, object listItemBar)
      : base(cellManager, colIndex, rowIndex, areaColIndex, areaRowIndex, inCellX, inCellY, cellRect, MousePosX, MousePosY, propAxisBar, listItemBar)

    {
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }

  }

  public class DataGridDataCellClientAreaNeededEventArgs : DataAxisGridDataCellClientAreaNeededEventArgs
  {
    public DataGridDataCellClientAreaNeededEventArgs(PropertyAxisBar propAxisBar, object listItemBar, Rectangle cellRect, DataAxisGridDataCellMan cell)
      : base(propAxisBar, listItemBar, cellRect, cell)
    {
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridDataCellOptimalWidthNeededEventArgs : DataAxisGridDataCellOptimalWidthNeededEventArgs
  {
    public DataGridDataCellOptimalWidthNeededEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell)
      : base(propAxisBar, listItemBar, cell)
    {
    }

    public DataGridColumn Column
    {
      get { return (DataGridColumn)PropAxisBar; }
    }

    public DataGridRow Row
    {
      get { return (DataGridRow)ListItemBar; }
    }
  }

  public class DataGridValuesAreDuplicatesStateNeededEventArgs : HandledEventArgs
  {
    private DataGridColumn column;
    private DataGridRow row1;
    private DataGridRow row2;
    private bool valuesAreDuplicates;

    public DataGridValuesAreDuplicatesStateNeededEventArgs(DataGridColumn column,
      DataGridRow row1, DataGridRow row2)
    {
      this.column = column;
      this.row1 = row1;
      this.row2 = row2;
    }

    public DataGridColumn Column
    {
      get { return column; }
    }

    public DataGridRow Row1
    {
      get { return row1; }
    }

    public DataGridRow Row2
    {
      get { return row2; }
    }

    public bool ValuesAreDuplicates
    {
      get { return valuesAreDuplicates; }
      set { this.valuesAreDuplicates = value; }
    }

    public bool AreValuesDuplicates(DataGridValuesAreDuplicatesStateNeededEventArgs e)
    {
      column.InternalOnValuesAreDuplicatesStateNeeded(e);
      return e.ValuesAreDuplicates;
    }
  }

}
