简体   繁体   中英

How can I create a table like Visual Studio's watch window?

I want to display data about some objects in my program, in a way similar to how Visual Studio's watch window works - A tree list with two columns, name and value, with the ability to expand non-primitive members further as child nodes in the tree structure.

I've been trying to do this with ObjectListView, but I can't seem to get it to happen. OLV seems to want to stick the members in individual columns, horizontally, while I want them to be displayed vertically, under the parent object (if that makes sense).

For winforms project there is a control - PropertyGrid that does this almost automatically, you need to set some attributes on the properties: [ReadOnly(bool)] – is the property read only. [Browsable(bool)] – is it browsable, ie to show in the property grid or not. [Category(string)] – the parent group of the property [Description(string)] – the description. It is displayed on the bottom label when you select the property. [DisplayName(string)] - you can override the display name. Additional information you can find here: https://msdn.microsoft.com/en-us/library/aa302326.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM