protected override List <AutomationPeer> GetChildrenCore()
        {
            if (_children != null)
            {
                foreach (AutomationPeer peer in _children)
                {
                    IAutomationFocusChangedEventSource unhookEventPeer = peer as IAutomationFocusChangedEventSource;
                    if (unhookEventPeer != null)
                    {
                        unhookEventPeer.UnloadEventHook();
                    }
                }
                _children.Clear();
            }

            // See if we have access to the QuickTypes combo box (it may or may not be available)
            AutomatedChoiceEditor choiceEditor = VisualTreeUtils.GetNamedChild <AutomatedChoiceEditor>(_editor, "PART_ValueEditor");

            // If we do, present it as one of our children
            if (choiceEditor != null)
            {
                _children.Add(new HiddenUIElementAutomationPeer(choiceEditor));
            }

            // Add any sub-properties
            ItemsControl properties = VisualTreeUtils.GetNamedChild <ItemsControl>(_editor, "PART_SubPropertyList");

            if (properties != null)
            {
                int childCount = properties.Items.Count;

                for (int i = 0; i < childCount; i++)
                {
                    PropertyContainer propertyContainer = properties.ItemContainerGenerator.ContainerFromIndex(i) as PropertyContainer;

                    if (propertyContainer != null)
                    {
                        PropertyContainerAutomationPeer peer = new PropertyContainerAutomationPeer(propertyContainer);
                        _children.Add(peer);
                    }
                }
            }

            return(_children);
        }
 protected override List <AutomationPeer> GetChildrenCore()
 {
     _children = new List <AutomationPeer>();
     if (_container != null)
     {
         CategoryContainerAutomationPeer.AddCategoryEditors(_children, VisualTreeUtils.GetNamedChild <ItemsControl>(_container, "PART_AdvancedCategoryEditors"), Resources.PropertyEditing_AdvancedCategoryEditors);
         CategoryContainerAutomationPeer.AddCategoryProperties(_children, VisualTreeUtils.GetNamedChild <ItemsControl>(_container, "PART_AdvancedPropertyList"));
     }
     //Add focus events for Subproperty editor
     foreach (AutomationPeer peer in _children)
     {
         PropertyContainerAutomationPeer pcAutomationPeer = peer as PropertyContainerAutomationPeer;
         if (pcAutomationPeer != null)
         {
             pcAutomationPeer.AddFocusEvents();
         }
     }
     return(_children);
 }
        protected override List<AutomationPeer> GetChildrenCore() 
        {
            if (_children != null) 
            {
                foreach (AutomationPeer peer in _children) 
                {
                    IAutomationFocusChangedEventSource unhookEventPeer = peer as IAutomationFocusChangedEventSource;
                    if (unhookEventPeer != null) 
                    {
                        unhookEventPeer.UnloadEventHook();
                    }
                }
                _children.Clear();
            }

            // See if we have access to the QuickTypes combo box (it may or may not be available)
            AutomatedChoiceEditor choiceEditor = VisualTreeUtils.GetNamedChild<AutomatedChoiceEditor>(_editor, "PART_ValueEditor");

            // If we do, present it as one of our children
            if (choiceEditor != null) 
            {
                _children.Add(new HiddenUIElementAutomationPeer(choiceEditor));
            }

            // Add any sub-properties
            ItemsControl properties = VisualTreeUtils.GetNamedChild<ItemsControl>(_editor, "PART_SubPropertyList");

            if (properties != null) 
            {
                int childCount = properties.Items.Count;

                for (int i = 0; i < childCount; i++) 
                {
                    PropertyContainer propertyContainer = properties.ItemContainerGenerator.ContainerFromIndex(i) as PropertyContainer;

                    if (propertyContainer != null) 
                    {
                        PropertyContainerAutomationPeer peer = new PropertyContainerAutomationPeer(propertyContainer);
                        _children.Add(peer);
                    }

                }
            }

            return _children;
        }