问题
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