Silverlight自定义中如何注册自定义委托事件
本帖最后由 mykge 于 2012-12-21 15:26:26 编辑 我在Silverlight中写了一个自定义控件,想给这个控件添加一个“Click”事件,在WPF里面我是我这样做的
public static readonly RoutedEvent ClickEvent =
EventManager.RegisterRoutedEvent("Click", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(JButton));
public event RoutedEventHandler Click
{
add { AddHandler(ClickEvent, value); }
remove { RemoveHandler(ClickEvent, value); }
}
但是在Silverlight里面没有EventManager,在Silverlight里面应该应该如何把Click注册为RouteEvent
[解决办法]
不用注册,写完了以后重新生成一下就可以了。