改列编辑器类型而不更改GridControl中的过滤器编辑器类型

改列编辑器类型而不更改GridControl中的过滤器编辑器类型

本文介绍了更改列编辑器类型而不更改GridControl中的过滤器编辑器类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了以下GridColumn:

I have the following GridColumn defined:

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

这可以正常工作,并将我的blah列的编辑器更改为正确的编辑器,但是它也具有将该列的AutoFilterRow编辑器更改为相同的GridLookUpEdit的不良影响.我希望过滤器只是一个常规的文本编辑字段.我该如何实现?

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?

推荐答案

您需要设置 GridColumn.FilterMode 属性设置为 ColumnFilterMode.DisplayText 值,它将允许按以下条件过滤列中的值其DisplayText,因此AutoFilterRow中的字段编辑器将更改为常规文本编辑器:

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
    }
}

这篇关于更改列编辑器类型而不更改GridControl中的过滤器编辑器类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 05:16