博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
强大DevExpress,Winform LookUpEdit 实现多列查询 gridview弹出下拉选择 z
阅读量:6935 次
发布时间:2019-06-27

本文共 2480 字,大约阅读时间需要 8 分钟。

关键代码请参考

  

The current implementation doesn't provide interfaces to force the described feature to work automatically. However, in this article, we'll try to create a descendant and introduce the required behavior.

To accomplish this task, we'll have to create and descendants.

To force the drop-down grid to apply a proper filter condition, we need to override the OnCreateLookupDisplayFilter method. Here is some sample code:

[C#]
Open in popup window
public class CustomGridView : GridView{
public CustomGridView() : base() {
} protected override string OnCreateLookupDisplayFilter(string text, string displayMember) {
string exp = LikeData.CreateContainsPattern(text); string searchString = ""; foreach (GridColumn col in Columns) {
if (col.Visible) searchString = searchString + new BinaryOperator(col.FieldName, exp, BinaryOperatorType.Like).ToString() + " Or "; } searchString = searchString.Substring(0, searchString.Length - 4); return searchString; } protected virtual internal string GetExtraFilterText {
get {
return ExtraFilterText; } }}

Additionally, it is necessary to highlight all found matches. To do this, we should override the view's painting mechanism. This can be done by creating our custom painter and by overriding the DrawRowCell method:

[C#]
Open in popup window
public class CustomGridPainter : GridPainter{
public CustomGridPainter(GridView view) : base(view) {
} public virtual new CustomGridView View {
get {
return (CustomGridView)base.View; } } protected override void DrawRowCell(GridViewDrawArgs e, GridCellInfo cell) {
cell.ViewInfo.MatchedStringUseContains = true; cell.ViewInfo.MatchedString = View.GetExtraFilterText; cell.State = GridRowCellState.Dirty; e.ViewInfo.UpdateCellAppearance(cell); base.DrawRowCell(e, cell); }}

Now you should properly register it, to make it available. Please refer to the article to learn more on how to accomplish this.

Finally you should create a descendant, an override the RepositoryItemGridLookUpEdit.CreateViewInstance and RepositoryItemGridLookUpEdit.CreateGrid methods.

The attached example contains descendants of the , GridPainter, , classes.

Additionally, there are and GridInfoRegistrator descendants for registering a custom grid view.

See Also:

更多
 

转载地址:http://cjgjl.baihongyu.com/

你可能感兴趣的文章
Kafka: Connect
查看>>
hibernate(七) hibernate中查询方式详解
查看>>
用gulp构建你的前端项目
查看>>
cmd for 循环拷贝文件
查看>>
【转】PHP date("Y-m-d H:i:s");获取当前时间 差8小时解决办法
查看>>
System.Security.Cryptography.CryptographicException,密钥集不存在
查看>>
敏捷团队中的QA由来
查看>>
gdb调试报错:Missing separate debuginfos, use: debuginfo-install glibc-XXX
查看>>
根据百度API获得经纬度,然后根据经纬度在获得城市信息
查看>>
mariadb 10.1查看per connection内存消耗
查看>>
重装MAC系统 “安装器有效负载签名检查失败” 解决方法
查看>>
(转) Supercharging Style Transfer
查看>>
JMeter性能测试,验证请求数据的准确性(wc命令)
查看>>
Python学习札记(二十三) 函数式编程4 sorted
查看>>
跟着百度学PHP[14]-PDO-优化驱动
查看>>
mysql的.sql文件头部 /*!32312 IF NOT EXISTS*/;
查看>>
ONVIF测试方法及工具
查看>>
《ArcGIS Runtime SDK for Android开发笔记》——数据制作篇:发布具有同步能力的FeatureService服务...
查看>>
Oracle快速克隆安装
查看>>
Spring Boot中使用JdbcTemplate访问数据库
查看>>