Open
Description
Background and motivation
I was asked to create this API proposal for, PR #7335
For automation of UI-Tests we need to get access to menu items that are grouped (#6530). At the moment this is not possible because GroupItemAutomationPeer
only creates automation peers for its children if the parent peer container is type of ItemsControlAutomationPeer
.
API Proposal
Change inheritance of following types
namespace System.Windows.Automation.Peers
{
- public class MenuAutomationPeer : FrameworkElementAutomationPeer
+ public class MenuAutomationPeer : ItemsControlAutomationPeer
{
}
- public class ContextMenuAutomationPeer : FrameworkElementAutomationPeer
+ public class ContextMenuAutomationPeer : ItemsControlAutomationPeer
{
}
- public class MenuItemAutomationPeer : FrameworkElementAutomationPeer, IExpandCollapseProvider, IInvokeProvider, IToggleProvider
+ public class MenuItemAutomationPeer : ItemsControlAutomationPeer, IExpandCollapseProvider, IInvokeProvider, IToggleProvider
{
}
ItemsControlAutomationPeer is directly derived from FrameworkElementAutomationPeer. The above types are moved deeper into the inheritance chain.
API Usage
This change effects how GroupItemAutomationPeer
handles menu items. The API is used by tools like Ranorex for automated UI testing. In the end, the children of a menu item group should also be visible in the automation tree.
Alternative Designs
None
Risks
None
Metadata
Metadata
Assignees
Labels
No labels