The AutomationId property is attached one and in order to set it from code you will need to access them through the static class that holds them. Here is an example with the AutomationId property:
var tool =
Text = caption,
Size = ButtonSize.Large,
LargeImage = img
You can find more information on how to set attached properties in this article
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items