DevExpress LookupEdit RowFilter

Existem dois métodos para fazer isso.

  • Alterar fonte de dados
DataTable oldDataTable = myLookUpEdit.Properties.DataSource as DataTable;
DataRow[] myDataRows = oldDatatable.Select(filter);
DataTable newDataTable = oldDataTable.Clone();

foreach (DataRow dr in myDataRows) newDataTable.ImportRow(dr); ;
myLookupEdit
.Properties.DataSource = newDataTable;
  • Use GridLookUpEdit
myGridLookUpEdit.Properties.View.CustomRowFilter += (s, e) =>
{
DevExpress.XtraGrid.Views.Grid.GridView myView =
s
as DevExpress.XtraGrid.Views.Grid.GridView;

DataView myDataView = myView.DataSource as DataView;

if (myDataView[e.ListSourceRow][index] holds some condition)
{
e
.Visible = false; //hidden some row
e
.Handled = true;
}
};