Ejemplo n.º 1
0
        public void AntesAfectarObjeto(object sender, AfectarObjetosEventArgs e)
        {
            if (this.RaiseEvent)
            {
                e.Modulo   = this.Modulo;
                e.Objeto   = this.dgrLista.CurrentRow.DataBoundItem;
                e.RowIndex = this.dgrLista.CurrentRow.Index;
                e.ColIndex = this.dgrLista.CurrentCell.ColumnIndex;

                if (e.ListaSeleccionados == null)
                {
                    e.ListaSeleccionados = new List <object>();
                }

                DataGridViewCell[] ls = new DataGridViewCell[this.dgrLista.SelectedCells.Count];
                this.dgrLista.SelectedCells.CopyTo(ls, 0);

                foreach (int item in ls.GroupBy(x => x.RowIndex).Select(x => x.First().RowIndex))
                {
                    e.ListaSeleccionados.Add(this.dgrLista.Rows[item].DataBoundItem);
                }
                e.Lista = this.dgrLista.DataSource;
            }
        }