1. using System;
  2. using System.ComponentModel;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. using System.Text;
  6.  
  7. using DevExpress.ExpressApp;
  8. using DevExpress.ExpressApp.Actions;
  9. using DevExpress.Persistent.Base;
  10. using DevExpress.ExpressApp.Win.Editors;
  11. using DevExpress.XtraGrid.Views.Grid;
  12. using DevExpress.XtraGrid.Columns;
  13. using DevExpress.Utils.Menu;
  14. using DevExpress.XtraGrid.Menu;
  15. using System.Drawing;
  16. using DevExpress.ExpressApp.Utils;
  17.  
  18. namespace E1554.Module
  19. {
  20. public partial class FixclomunViewController : ViewController<ListView>
  21. {
  22. public FixclomunViewController()
  23. {
  24. InitializeComponent();
  25.  
  26. }
  27.  
  28. protected override void OnDeactivated()
  29. {
  30. base.OnDeactivated();
  31. }
  32.  
  33. protected override void OnViewControlsCreated()
  34. {
  35. base.OnViewControlsCreated();
  36. // Access and customize the target View control.
  37. GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;
  38. if (listEditor != null)
  39. {
  40. XafGridView gridView = listEditor.GridView as XafGridView;
  41. gridView.PopupMenuShowing += new PopupMenuShowingEventHandler(gridView_PopupMenuShowing);
  42. }
  43.  
  44. }
  45. private void gridView_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
  46. {
  47. if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Column)
  48. {
  49. DevExpress.XtraGrid.Menu.GridViewColumnMenu menu = e.Menu as GridViewColumnMenu;
  50.  
  51. if (menu.Column != null)
  52. {
  53.  
  54. //Adding new items
  55. DXPopupMenu popMenu = new DXPopupMenu();
  56. popMenu.Caption = "凍結列";
  57. menu.Items.Add(popMenu);
  58.  
  59. popMenu.Items.Add(CreateCheckItem("取消", menu.Column, FixedStyle.None,
  60. ImageLoader.Instance.GetImageInfo("NotFixed").Image));
  61. popMenu.Items.Add(CreateCheckItem("左側", menu.Column, FixedStyle.Left,
  62. ImageLoader.Instance.GetImageInfo("FixedLeft").Image));
  63. popMenu.Items.Add(CreateCheckItem("右側", menu.Column, FixedStyle.Right,
  64. ImageLoader.Instance.GetImageInfo("FixedRight").Image));
  65. }
  66.  
  67. }
  68. }
  69.  
  70. //Create a menu item
  71. DXMenuCheckItem CreateCheckItem(string caption, GridColumn column, FixedStyle style, Image image)
  72. {
  73. DXMenuCheckItem item = new DXMenuCheckItem(caption, column.Fixed == style,
  74. image, new EventHandler(OnFixedClick));
  75. item.Tag = new MenuInfo(column, style);
  76. return item;
  77. }
  78.  
  79. //Menu item click handler
  80. void OnFixedClick(object sender, EventArgs e)
  81. {
  82. DXMenuItem item = sender as DXMenuItem;
  83. MenuInfo info = item.Tag as MenuInfo;
  84. if (info == null) return;
  85. info.Column.Fixed = info.Style;
  86. }
  87.  
  88. //The class that stores menu specific information
  89. class MenuInfo
  90. {
  91. public MenuInfo(GridColumn column, FixedStyle style)
  92. {
  93. this.Column = column;
  94. this.Style = style;
  95. }
  96. public FixedStyle Style;
  97. public GridColumn Column;
  98. }
  99. }
  100. }

[原] XAF ListView 凍結列的更多相关文章

  1. [原] XAF ListView显示隐藏Footer菜单

    using System; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Win.Editors; using DevExpress ...

  2. [WPF]ListView点击列头排序功能实现

    [转]   [WPF]ListView点击列头排序功能实现 这是一个非常常见的功能,要求也很简单,在Column Header上显示一个小三角表示表示现在是在哪个Header上的正序还是倒序就可以了. ...

  3. [原] XAF 如何启用ListView Top N records 提升用户使用体验

    為了提升用戶使用體驗,特擴展此功能(來源與Xafari Framework).1.可在模型編輯器中設置是否啓用,默認啓用.2.DataAccessMode為Client模式才啓用.其它模式自動關閉.3 ...

  4. [原] XAF 如何啟用ListView橫向滾動條

    using System; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Win.Editors; using DevExpress ...

  5. [原] XAF How to bind a stored procedure to a ListView in XAF

    First, I suggest that you review the following topic to learn how to show a custom set of objects in ...

  6. [原] XAF How to Edit multiple objects in a ListViewAndDetailView

    2014年好久没有更新Blog了,工作调换了,很少用XAF,但还是很关注XAF的发展和学习,对中国的中小企业数据管理软件开发真的太实用了!! 功能比较简单,但很实用,直接上图和代码! ListView ...

  7. 【原】sql 将某列拼成一个字符串

    SQL Server中,写存储过程,时常会碰到这样一个需求:从某个表中取某一列,然后需要将这一列数据以某种形式拼成一个字符串,以供后面使用,下面这种方法能够实现此需求. --取说明书模块枚举,结果格式 ...

  8. C# ListView点击列头进行排序

    /// <summary> /// This class is an implementation of the 'IComparer' interface. /// </summa ...

  9. [原] XAF 添加日期筛选下拉选择

    1.ListView 添加日期筛选下拉选择,选择指定,可指定日期范围 2.Code using DevExpress.Data.Filtering; using DevExpress.ExpressA ...

随机推荐

  1. swift 之 闭包

    一.闭包 格式:{  (  参数名:类型, 参数名:类型 ..  )   in 内容体  return  返回值   }  最完整的闭包 1.省略参数类型 {  (  参数名, 参数名..  )   ...

  2. Request header is too large

    当request url过长的时候,经常tomcat后台就会包 "Request header is too large"错误. 解决方法:修改server.xml文件,linux ...

  3. codeforces 742D (分组背包)

    D. Arpa's weak amphitheater and Mehrdad's valuable Hoses   Just to remind, girls in Arpa's land are ...

  4. SVN 集中式版本控制软件

    简介: 目前流行的版本控制软件中,SVN ( 集中式版本控制 ) 算是使用范围更广.且使用时间更早的一款了,现在 git ( 分布式版本控制 ) 更火爆一点. 一.安装svn [root@localh ...

  5. Lua 单例类

    function SingleTon:new() local store = nil return function(self) if store then return store end loca ...

  6. git 查看远程分支、本地分支、创建分支、把分支推到远程repository、删除本地分支

    1 查看远程分支 $ git branch -a * br-2.1.2.2 master remotes/origin/HEAD -> origin/master remotes/origin/ ...

  7. java 集合知识整理

    java集合类图 HashMap和Hashtable的区别   HashMap HashTable  继承方式 extends AbstractMap implements Map extends D ...

  8. Shell文本处理 - 分割合并与过滤

    sort分类操作 示例文件 Boys in Company C:HK:192:2192 Alien:HK:119:1982 The Hill:KL:63:2972 Aliens:HK:532:4892 ...

  9. final

    final的变量的值不能被改变.(包括形参) final的方法不能被重写. final的类不能被继承.

  10. [Gnu]Centos7 解决 gdb 提示 Missing separate debuginfos

    Centos7 上使用gdb: $ gdb php $ run /home/www/2.php 运行完 run,后面跟着很长的提示: …. Missing separate debuginfos, u ...