/// <summary> /// 触发某个路由事件 /// </summary> /// <param name="indicator"></param> /// <param name="args"></param> protected void RaiseRoutedEvent(RoutedViewEvent indicator, EventArgs args) { var arg = new RoutedViewEventArgs { SourceView = this, Event = indicator, Args = args }; this.OnRoutedEvent(this, arg); }
/// <summary> /// 发生某个路由事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnRoutedEvent(object sender, RoutedViewEventArgs e) { if (e.Event.Type == RoutedEventType.ToParent) { if (this._parent != null) { this._parent.OnRoutedEvent(sender, e); } } else { for (int i = 0, c = this._childrenViews.Count; i < c; i++) { var child = this._childrenViews[i]; child.OnRoutedEvent(sender, e); } } }