How can I specify AutomationIDs for Panes, Diagrams, and Nodes created at run-time in a project with MVVM architecture? Is there any example available?
1 Answer, 1 is accepted
0
Peshito
Telerik team
answered on 24 Mar 2017, 11:19 AM
Hello,
When an element is dynamically created this makes it harder to set an AutomationId automatically. The AutomationId is an attached dependency property and you can set a binding on it which will solve this issue. What you need to do basically is to create a style targeting the element you would like to apply an AutomationId to. Please take a look at the code below for example:
As for setting an AutomationId to the Diagram simply set it's AutomationId property: AutomationProperties.AutomationId="DiagramAutomationID"
Hope this helps.
Regards,
Peshito
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.