c#路由事件

2017-06-14 12:16:38来源:CSDN作者:new_smile人点击

public static readonly DependencyProperty PageIndexProperty =    DependencyProperty.Register("PageIndex", typeof(int), typeof(MoonPdfPanel), new UIPropertyMetadata(1)); public int PageIndex{    get {return (int)GetValue(PageIndexProperty);}    set { SetValue(PageIndexProperty, value); }} public static readonly RoutedEvent PageIndexChangedEvent = EventManager.RegisterRoutedEvent("PageIndexChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler<int>), typeof(MoonPdfPanel)); public event RoutedPropertyChangedEventHandler<int> PageIndexChanged{    add { AddHandler(PageIndexChangedEvent, value); }    remove { RemoveHandler(PageIndexChangedEvent, value); }} // 触发事件,结尾一定要使用RaiseEvent(args)来触发路由事件。RoutedPropertyChangedEventArgs<int> args =        new RoutedPropertyChangedEventArgs<int>(            val, this.GetCurrentPageNumber(), PageIndexChangedEvent);    this.RaiseEvent(args);

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台