AutomationID and Templates
I define the following ListBox
<ListBox
ItemsSource="{Binding Source={StaticResource contactsView}}"
HorizontalAlignment="Right"
Margin="0,100,70,160"
Name="listBox1"
AutomationProperties.AutomationId="ContactsList">
</ListBox>
and the following template
<Window.Resources>
<DataTemplate DataType="{x:Type src:Contact}">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch">
<TextBlock Text="{Binding Path=Name}"
Width="70"
AutomationProperties.AutomationId="ContactName"/>
<Button Content="Call"
Margin="3,3,3,3"
Click="OnContactClick"
AutomationProperties.AutomationId="ContactCall"/>
</StackPanel>
</DataTemplate>
<CollectionViewSource Source="{Binding Source={x:Static Application.Current}, Path=Contacts}" x:Key="contactsView"/>
</Window.Resources>
then I populate the listBox.
Is there a way to dinamically create AutomationIDs for the template generated ListBoxItems?
Or what else would you suggest to access these elements?

