The ListViewItem.ListView property will automatically be set after being added to a owner ListView. However the ListViewItem.ListView property has no setter.
ListViewItem item = new ListViewItem(); // item.ListView == null here.
listView.Items.Add( item ); // item.ListView != null where no setter.
I’d like to know the implementation of ListViewItem.ListView get property.
What a private field is set inside the ListView.Items.Add() method? And how?
I’m trying craeting similar class relationship as a relationship between ListView and ListViewItem.
Thanks much for your help.
ListViewItemCollection.Addcalls (indirectly) an internal method onListViewItem:(you can see this code in a decompiler like Reflector or JustDecompile)