I have an ItemsControl that is bound to a collection.
<ItemsControl ItemsSource="{Binding Classroom.Teachers}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBox x:Name="tbx" Width="40"/>
<ComboBox x:Name="cmb" Width="100"/>
<Button Click="OnClick">
<TextBlock Text="Add"/>
</Button>
</StackPanel>
<DataTemplate>
</ItemsControl>
In the OnClick
handler of the button how to I get the values of tbx
and cmb
that are local to the DataTemplate of the button which was clicked?