Exemple #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);

                if (child is FrameworkElement frameworkElement && frameworkElement.Name == childName)
                {
                    return(frameworkElement);
                }
            }

            for (int i = 0; i < childrenCount; i++)
            {
                DependencyObject child = VisualTreeHelper.GetChild(parent, i);

                child = StatusBarInjector.FindChild(child, childName);

                if (child != null)
                {
                    return(child);
                }
            }

            return(null);
        }
Exemple #2
0
        private void CreateStatusBarItem()
        {
            _status = new RadialControllerStatusBarHost {
                Name = "PART_DialControllerHost"
            };
            var injector = new StatusBarInjector(Application.Current.MainWindow);

            injector.InjectControl(_status);
        }