【发布时间】:2014-02-05 10:54:51
【问题描述】:
我有一个dataTreeListView,其中添加了几个列标题,如下所示:
oCol2.IsVisible = false;
dataTreeListView.AllColumns.AddRange(new OLVColumn[] { oCol1, oCol2, oCol3, oCol4, oCol5});
dataTreeListView.KeyAspectName = id;
dataTreeListView.ParentKeyAspectName = ParentId;
dataTreeListView.DataSource = list;
dataTreeListView.RootKeyValue = 0;
列表本身有 7 个属性(包括 Id 和 ParentId)。
我想要实现的是,在 selectedIndex 更改组合框时,列标题将更改位置。
From View (type1) (oCol2.IsVisible = false):
oCol1 (expandable) | oCol2 (hidden) | oCol3 | oCol4 | oCol5
To View (type2) (oCol2.IsVisible = true):
oCol2 | oCol1 (expandable) | oCol3 | oCol4 | oCol5
我现在得到的是视图 (type1) 工作正常,但切换到视图 type2 后,可扩展列仍然位于 oCol1 而不是 oCol2。看来我不能switch主列。
对此有什么帮助吗?
【问题讨论】:
-
type2 视图首先定义 oCol2,然后定义 oCol1(可扩展)。根据您的问题,这看起来像是预期的输出。除非我错过了什么。
-
嗨 theghostofc,我尝试过这样做。 dataTreeListView.AllColumns.Clear(); oCol2.IsVisible = true; dataTreeListView.AllColumns.AddRange (new OLVColumn[] { oCol2, oCol1, oCol3, oCol4, oCol5, });结果还是一样,第一列的oCol1
标签: c# objectlistview