December 2009 Entries

QuickTip: Getting ItemIndex from ListView_Command event

Just a quick tip today, for something that I use often, and maybe others are wondering what’s the fastest way to figure out what item is actually calling the command. So for our ListView_Command method, we have a “ListViewCommandEventArgs” parameter, which exposes the following properties; So we can get to the Item, but that doesn’t really help us figure out what Item is actually calling the command. Easy enough. I’ll need to use e.Item to get to the index. First I’ll make it into a ListViewDataItem, ......