private void UiVistaBodegas_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) { var edit = ActiveControl as DevExpress.XtraEditors.SearchLookUpEdit; if (edit == null) { return; } if (e.ControllerRow >= 0) { var bodega = (Bodega)UiVistaBodegas.GetRow(e.ControllerRow); bodega.IS_SELECTED = (e.Action == CollectionChangeAction.Add); } else { if (UsuarioSeleccionoListaBodegasCompleta) { for (var i = 0; i < UiVistaBodegas.RowCount; i++) { var bodega = (Bodega)UiVistaBodegas.GetRow(i); if (bodega == null) { continue; } bodega.IS_SELECTED = (UiVistaBodegas.SelectedRowsCount != 0); } UsuarioSeleccionoListaBodegasCompleta = false; } } edit.Text = string.Join(",", Bodegas.Where(bodega => bodega.IS_SELECTED).Select(bodega => bodega.NAME)); }
private void UiVistaBodegas_BeforeLeaveRow(object sender, DevExpress.XtraGrid.Views.Base.RowAllowEventArgs e) { for (var i = 0; i < UiVistaBodegas.RowCount; i++) { var bodega = (Bodega)UiVistaBodegas.GetRow(i); if (bodega == null) { continue; } if (bodega.IS_SELECTED) { UiVistaBodegas.SelectRow(i); } } }