[Usercontrol] CollectionBase
Hello
I've made my own ToolBarNavigator usercontrol, It have a lot of buttons and
other stuff. Also having dropdownbutton's for Phones, Emails and WebSites.
The item for Phone, Email and Websites i'll have a CallItem class.
public class CallItem
{
public CallItem(ESCallType Type, string CallValue)
{
}
}
This Item is then added to a Collection class based on the CollectionBase.
When ill Add the item to that collectionbase's InnerList i'll want to raise
an event CallItemAdded.
I'll created the delegate like:
public delegates void CallItemAddedHandler(CallItem Item);
public event CallItemAddedHandler CallItemAdded;
The method for adding the item:
public void Add(CallItem Item)
{
this.Innerlist.Add(Item);
... the raise
if ( CallItemAdded != null )
CallItemAdded(Item);
}
I'll do the way many times, and it works just fine, but here the
CallItemAdded is always Null, so the event is never raised?
On the usercontrol i'll instansiate the PhoneCallItems and add the
PhoneCallItems.CallItemAdded event, this way i'll know when an item is added
to the collection, and i can display the string value as a dropdownitem in
the phone dropdownbutton.
Kind regards
Johnny E Jensen
Date:Wed, 22 Aug 2007 22:32:21 +0200
Author:
|