[Mono-devel-list] ListViewItem.ListView
Miguel de Icaza
miguel at ximian.com
Sun Sep 21 21:14:07 EDT 2003
Hello,
> The ListViewItem class has a property called ListView that returns the
> ListView control that contains this ListViewItem. How does ListViewItem class
> knows who is its container, if it is not specified in the construtor or in any
> other member ? I guess that I'm missing something there.
>
> Any help will be appreciated.
Initially the ListViewItem is born with a null parent; When the parent
adds the individual items, it will call a method to set the parent,
something like this:
class ListView {
Add (ListViewItem item)
{
item.SetParent (this);
}
}
class ListViewItem {
ListView parent = null;
public ListView ListView {
get { return parent; }
}
internal SetParent (ListView p)
{
parent = p;
}
}
More information about the Mono-devel-list
mailing list