private void BubbleEvent(RoutedEventArgs e) { UIElement target = this; while (target != null) { target.RaiseEventImpl(e); target = VisualTreeHelper.GetAncestor <UIElement>(target); } }
private UIElement FindFocusable(object o) { UIElement ui = o as UIElement; while (ui != null) { if (ui.IsVisible && ui.Focusable) { return(ui); } ui = VisualTreeHelper.GetAncestor <UIElement>(ui); } return(null); }