private void filterControl1_CreateCustomRepositoryItem(object sender, DevExpress.XtraEditors.Filtering.CreateCustomRepositoryItemEventArgs e) { if (e.Column.FieldName == "CategoryName") { RepositoryItemComboBox riComboBox = new RepositoryItemComboBox(); using (NWindDataContext context = new NWindDataContext()) { riComboBox.Items.AddRange( context.Categories .Select(c => c.CategoryName) .ToList() ); } e.RepositoryItem = riComboBox; } }
public Form1() { InitializeComponent(); using (NWindDataContext context = new NWindDataContext()) { Products = context.Products .Include("Category") .Select(p => new ProductAggregate { ProductName = p.ProductName, CategoryName = p.Category.CategoryName, QuantityPerUnit = p.QuantityPerUnit, UnitPrice = p.UnitPrice.Value, UnitsInStock = p.UnitsInStock.Value, UnitsOnOrder = p.UnitsOnOrder.Value }) .ToList(); } }