private static FindChild ( |
||
parent | ||
childName | string | |
return |
private static DependencyObject FindChild(DependencyObject parent, string childName) { if (parent == null) { return(null); } int childrenCount = VisualTreeHelper.GetChildrenCount(parent); for (int i = 0; i < childrenCount; i++) { DependencyObject child = VisualTreeHelper.GetChild(parent, i); FrameworkElement frameworkElement = child as FrameworkElement; if (frameworkElement != null && frameworkElement.Name == childName) { return(frameworkElement); } child = StatusBarInjector.FindChild(child, childName); if (child != null) { return(child); } } return(null); }
private void FindStatusBar() { _statusBar = StatusBarInjector.FindChild(_window, "StatusBarContainer") as FrameworkElement; _panel = _statusBar.Parent as DockPanel; }