Find TextBox in a DataTemplate
问题 Have some elements in a DataTemplate that I need to access in a code behind event handler. Below works if the button and the textbox have the same Parent. How would I handle a more complex layout? If there a general way for accessing an element in a DataTemplate? XAML <DataTemplate x:Key="fieldDateTemplate"> <StackPanel> <DatePicker SelectedDate="{Binding Path=FieldValue}" /> <TextBox x:Name="tbFindMe" Text="findME"/> <Button Content="FindTB" Click="FindTB_click" Width="60"