How to disable a ListViewItem?
-
Hi gurus, I need to disable some items inside a ListView control. As far as I know ListViewItem has no Enabled property or something like it. How can I disable a ListViteItem? Thanks
Aref
-
Hi gurus, I need to disable some items inside a ListView control. As far as I know ListViewItem has no Enabled property or something like it. How can I disable a ListViteItem? Thanks
Aref
Hi Dear, I don't know ListViewItem control in 2005. But if you had you can do Visible true false only in RowDataBound Events only...... You have to find control by Casting it you can do visible true false; Thanks:laugh:
"Good Thing Goes With Good People..."
-
Hi gurus, I need to disable some items inside a ListView control. As far as I know ListViewItem has no Enabled property or something like it. How can I disable a ListViteItem? Thanks
Aref
Hi! What do you mean by "disabling" a LVItem? Should it get a different color? Should the user not be able to select the item? Should doubleclicking it perform differently than it does with other LVItems? Please specify more clearly.
Regards, mav -- Black holes are the places where God divided by 0...
-
Hi! What do you mean by "disabling" a LVItem? Should it get a different color? Should the user not be able to select the item? Should doubleclicking it perform differently than it does with other LVItems? Please specify more clearly.
Regards, mav -- Black holes are the places where God divided by 0...
It is pretty clear that what Enabled and Disabled mean. As you mentioned , Disable items must look Gray and could not be selected. Also their Click, Doubleclick and other such events must not be triggered. thanks
Aref
-
It is pretty clear that what Enabled and Disabled mean. As you mentioned , Disable items must look Gray and could not be selected. Also their Click, Doubleclick and other such events must not be triggered. thanks
Aref
Since MS didn't include an Enabled property for LVItems, it seems it isn't "pretty clear" what you consider a disabled item to be. ListViewItems are no controls on their own behalf, just like TreeNodes they are dependent from their containing parent control. Thus, Enabled does not have an inherent meaning by itself for child elements of controls. You'll have to implement whatever meaning you want "Enabled" to have on your own. "Their Click, Doubleclick and other such events" doesn't make sense, either - a LVItem doesn't fire these events, its containing ListView does. So if you want a ListView that can handle additional properties for its Items, you'll have to roll your own (i.e. derive from ListView and catch the appropriate events).
Regards, mav -- Black holes are the places where God divided by 0...
-
It is pretty clear that what Enabled and Disabled mean. As you mentioned , Disable items must look Gray and could not be selected. Also their Click, Doubleclick and other such events must not be triggered. thanks
Aref
Mav is dead on with his response. In order to do this, you'd have to roll your own ListView and ListViewItem classes to expose this kind of functionality. If you don't want to do that, you could always just remove the disabled items from the ListView. You really should read up on Windows GUI design guide. In there, it'll tell you why what you're doing is a bad idea. Something about a "consistant user experience". A ListView control is expected to provide a list of valid and selectable items. Turning off some items is an unexpected behavior for the control, thereby leading to confusion about how the control really works.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007