• Listview首列固定,不能移动到其他列


    ListView的首列是checkbox,所以想固定首列,不能移动。
    本想找到根本的解决办法,没找到。所以弄了这个笨办法。哪位知道怎么根本解决,麻烦告知,谢谢。
    var view = this.lvFiles.View as GridView; if (view != null && view.Columns != null) view.Columns.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Columns_CollectionChanged); } void Columns_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Move) { var view = this.lvFiles.View as GridView; if (view == null) return; if (view.Columns == null) return; if (e.NewStartingIndex == 0) { view.Columns.CollectionChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Columns_CollectionChanged); view.Columns.Move(e.NewStartingIndex, e.OldStartingIndex); view.Columns.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Columns_CollectionChanged); } if (e.OldStartingIndex == 0) { view.Columns.CollectionChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Columns_CollectionChanged); view.Columns.Move(e.NewStartingIndex, e.OldStartingIndex); view.Columns.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Columns_CollectionChanged); } } }

      

  • 相关阅读:
    装完某些软件之后IE主页被https://www.hao123.com/?tn=93453552_hao_pg劫持
    Python之向函数传递元组和字典
    Python之变量作用域
    Python之循环遍历
    Python之元组、列表and 字典
    Python数据类型
    Python运算
    Python变量空间
    Python编译源文件& 代码优化
    299. Bulls and Cows
  • 原文地址:https://www.cnblogs.com/xiaokang088/p/2766548.html
Copyright © 2020-2023  润新知