Because it was a button with a function that changes the color each time the button was pressed, which was created by the developer of an existing program, it seems that there is no way to do it even with the method implemented via thexxxAutomationPeerobject did.
Results of investigation on the other side
{Binding SomeCommand}is defined inICommandSince the containedUserControlwas found to have a property that returns aICommandobject, it uses the resulting object toICommand.Execute (), you can get the behavior I wanted to do.

The characters areexisting programandcreation program.
Existing programis a WPF app.
Create programis a form app.
Created programrefers toexisting programdynamically and is started in a separate thread.
The purpose ofCreate Programis to automatically complete a certain procedure by operatingExisting Program.

Here,onexisting programdefines a click event There are controls.
On the other hand, I want to execute event processing at the time of clicking fromcreation program.is what I want to do.

ButtonAutomationPeer I know, but the target control is notButton.

The source code cannot be presented for this question.
The reason is

  • The source code is confidential
  • Never developed a WPF app
  • In order to reproduce the situation accurately, you need to create a UserControl or generate a control dynamically in it, so you can't prepare immediately


I understand that it is difficult to get a specific solution because of these questions.
I would be grateful if you could give me the wisdom, "What should I do?"

Supplemental information (FW/tool version etc.)

Please provide more detailed information here.

  • Visual Studio 2015 SP1
  • Windows 7 64bit
  • Answer # 1

    Is it a content that can be handled by AutomationPeer other than


    Pattern list supported by each Control is here.
    Control Pattern Mapping for UI Automation Clients