开发者

Showing items in listview similar as in MS Access in C#

Is it possible to create ListView in C# (in Details View) just like in MS Access where when you can show in ListView things that are connected with particular item by some ID so you can clearly see those items are binded together. Currently I'm using colors so that when 3 items in same table are connected with same ID they are marked with one color, if next item has different ID then it has other color. This is ok solution but would prefer some clearer way.

 if (lastnumber != varOplatyLacznikID) {
    lastnumber = varOp开发者_开发百科latyLacznikID;
    lastcolor = lastcolor == Color.LightBlue ? Color.LightCyan : Color.LightBlue;
 }

I would like it to be displayed like this (more or less)

ITEM1 | VALUE1 | VALUE5

+ ITEM3 | VALUE1 | VALUE7

+ ITEM4 | VALUE1 | VALUE8

ITEM5 | VALUE2 | VALUE9

Normally it would display ITEM1 and ITEM5 but when i would click + sign next to ITEM1 it would show ITEM3 and ITEM4. It looks very nice in MS Access and would like to copy this functionality if it's not too much work.

Using ObjectListView is not in scope since I don't want to rebuild a lot of code to implement this functionality. I'm looking for a way to just extend what I've got.


Have you tried just using a TreeView? This would work if it's not absolutely necessary that the columns line up perfectly. Or you could use a fixed-width font and use Format() to make a string that contains fixed-width fields so that they do line up. It's a quick hack if you don't want to actually go to the trouble of making true expandable lists.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜