Set an AutomationProperties.AutomationId in code behind
code-behind, wpf
Solution
myCheckbox.SetValue(AutomationProperties.AutomationIdProperty, "checkBoxAutoID");
Problem
I have a WPF application that has a few legacy panels that were written mostly with code behind. I need to set the AutomationProperties.AutomationId for the controls on the panel. For example, this Checkbox ``` CheckBox myCheckbox = new CheckBox(); ``` How can I set AutomationProperties.AutomationId?