简体   繁体   中英

How to enable/disable listview subitem editing

I've created a checked listview programmatically, with one of the columns being an editable textbox. I want to enable or disable the subitem on each row according to the state of the checkbox, but can't find a property or a way to access the subitem's edit state. I've tried to cast the subitem back to a control, but that didn't work as well.

This is the solution I used. I hope there's a more elegant one: I created a List of TextBoxes and as I added a textbox to a ListViewItem I also added it to the list. In addition, I added a Tag to each ListViewItem with the TextBox's name. Now, when I check or uncheck a certain row I get the name of the control from the tag via lstItemList.Items[e.Index].SubItems[3].Tag.ToString() and search for it in the list. I change the Enabled property of the located TextBox.

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