Пример #1
0
        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);
        }
Пример #2
0
 private void FindStatusBar()
 {
     _statusBar = StatusBarInjector.FindChild(_window, "StatusBarContainer") as FrameworkElement;
     _panel     = _statusBar.Parent as DockPanel;
 }
Пример #3
0
 private void FindStatusBar()
 {
     this.statusBar = StatusBarInjector.FindChild(this.window, "StatusBarContainer") as FrameworkElement;
     this.panel     = this.statusBar.Parent as DockPanel;
 }