DevExpress过滤器编辑器:DropdownList

时间:2011-04-29 12:58:40

标签: c# winforms filter devexpress

Filter Editor中构建过滤器时,我可以提供可能的值列表吗?

示例:

enter image description here

我可以在这里使用可能的值而不是TextEdit的ComboBox吗?

1 个答案:

答案 0 :(得分:4)

是的,有可能。您应该处理GridView的FilterEditorCreated事件,如下所示:

private void gridView1_FilterEditorCreated(object sender, DevExpress.XtraGrid.Views.Base.FilterControlEventArgs e) {
    DevExpress.XtraEditors.Repository.RepositoryItemComboBox combo = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox();
    combo.Items.Add("Item 1");
    combo.Items.Add("Item 2");
    e.FilterControl.FilterColumns["ProductName"].SetColumnEditor(combo);
}