vs2008 c#: add events to eventlist control for facebook winform application
This is a desktop application. How do I add events to the event list control? The following code is not working
IList<user> friends = facebookService1.Friends.GetUserObjects();
IList<facebookevent> events = facebookService1.Events.Get();
friendList1.Friends = friends;
eventList1.FacebookEvents = events;
error message
Error 1 Cannot implicitly convert type 'System.Collec开发者_开发百科tions.Generic.IList' to 'System.Collections.ObjectModel.Collection'. An explicit conversion exists (are you missing a cast?) C:\Documents and Settings\ZULFIQAR SYED\Local Settings\Application Data\Temporary Projects\WindowsFormsApplication1\Form1.cs 42 41 WindowsFormsApplication1
Do you mean the protected Events
member (EventHandlerList
)?
private static readonly object MyEventKey = new object();
public event EventHandler MyEvent
{
add {Events.AddHandler(MyEventKey, value);}
remove {Events.RemoveHandler(MyEventKey, value);}
}
protected virtual void OnMyEvent()
{
EventHandler handler = (EventHandler)Events[MyEventKey];
if (handler != null) handler(this, EventArgs.Empty);
}
精彩评论