1

我有一个包含 2 列的 TreeListView 组件:“a”和“b”。

在我的列表中,有时我同时有“a”和“b”,但有时只有“a”。

如何删除“b”列中的以下消息(在不包含“b”的行中)?

“'b' 不是无参数的方法、属性或类型的字段......”

4

2 回答 2

2

当前版本的TreeListView(2.8.1,不确定何时添加)的解决方案是设置:

BrightIdeasSoftware.TreeListView.IgnoreMissingAspects = true;
于 2015-02-25T23:32:54.650 回答
2

我猜你说的TreeListViewObjectListView项目中的一个。

如果是这样,您将必须AspectGetter在“b”列上安装一个。当没有“b”属性时,让那个方面的 getter 返回 null。

this.olvColumnB.AspectGetter = delegate(object x) {
    ModelWithPropertyB model = x as ModelWithPropertyB;
    return model == null ? null : model.B;
}
于 2012-04-17T22:44:45.230 回答