【问题标题】:Get TreeListView cell value programmatically in ObjectListView在 ObjectListView 中以编程方式获取 TreeListView 单元格值
【发布时间】:2014-12-09 02:30:38
【问题描述】:

如何使用行和列索引以编程方式获取 OLV 的 treeListView 中单元格的值?

treeListView.GetItem(0).GetSubItemAt(6,e.rowIndex).Text 

例如似乎不起作用,它只是给了我第一行的第一个单元格的字符串值。我也不明白这里的答案:

ObjectListView: select subitem programmatically

【问题讨论】:

    标签: objectlistview


    【解决方案1】:

    不建议使用子项,并且在使用 ObjectListView/TreeListView 控件时永远不必访问它们。

    您应该改为检索所需行的模型对象,然后访问与相关列/单元格相关的属性。

    您可以使用

    检索模型
    MyModel model = objectListView1.GetModelObject(rowIndex) as MyModel
    

    其中 MyModel 是您的基础模型类。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-13
      • 2014-10-03
      • 2011-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      • 1970-01-01
      相关资源
      最近更新 更多