找回密码
 立即注册

QQ登录

只需一步,快速开始

dafeng520

论坛元老

19

主题

74

帖子

7661

积分

论坛元老

积分
7661

活字格认证

dafeng520
论坛元老   /  发表于:2014-6-24 16:06  /   查看:4393  /  回复:1
目前,在flexgrid下,可以采用OneWay或者IsReadOnly属性设置表格的只读。现有一个需求,单元格为只读,但可以选中单元格文字并复制到剪切板。请问如何实现。

1 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2014-6-25 17:20:00
沙发
回复 1楼dafeng520的帖子

我通过以下代码设置 IsReadOnly 属性是可以cell复制内容到剪切板的:

  1.         public MainWindow()
  2.         {
  3.             InitializeComponent();
  4.             List<Customer> cs = new List<Customer>();
  5.             for (int i = 0; i < 10; i++)
  6.             {
  7.                 Customer c = new Customer() ;
  8.                 c.ID = i;
  9.                 c.Name = "test";
  10.                 cs.Add(c);
  11.             }

  12.             this.flex1.ItemsSource=cs;
  13.             this.flex1.IsReadOnly = true;
  14.         }
  15.     }

  16.     public class Customer
  17.     {
  18.         public string Name { get; set; }
  19.         public int ID { get; set; }
  20.     }
复制代码


Demo:
Windows 8.1+ Studio for WPF 2014V1+VS2013


效果图:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部