Change column editor type without changing filter editor type in GridControl

淺唱寂寞╮ 提交于 2019-12-25 02:57:48

问题


I have the following GridColumn defined:

new GridColumn{
    Visible = true,
    FieldName = "blah",
    Name = "blah",
    ColumnEdit = new RepositoryItemGridLookUpEdit{
        DisplayMember = "Name",
        ValueMember = "Id",
        DataSource = ViewModel.Components
    }
}

This works fine and changes the editor of my blah column to a the correct editor, but it also has an unwanted side-effect of changing the AutoFilterRow editor for that column to that same GridLookUpEdit. I want the filter to be just a regular text edit field. How can I achieve this?


回答1:


You need to set GridColumn.FilterMode property to ColumnFilterMode.DisplayText value, it will allow filter values in your column by its DisplayText, so the field editor in AutoFilterRow will be changed to regular text editor:

new GridColumn {
    Visible = true,
    FieldName = "blah",
    Name = "blah",
    FilterMode = ColumnFilterMode.DisplayText, //<= filter mode
    ColumnEdit = new RepositoryItemGridLookUpEdit{
        DisplayMember = "Name",
        ValueMember = "Id",
        DataSource = ViewModel.Components
    }
}


来源:https://stackoverflow.com/questions/31149469/change-column-editor-type-without-changing-filter-editor-type-in-gridcontrol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!