Reference to a TextBox inside a DataTemplate
问题 How do I get a reference to a TextBox that's only defined inside a DataTemplate (assuming that I've just applied this DataTemplate to some cell in a grid). So far I'm using the sender in the TextBox events to retrieve this. Thanks, rui 回答1: For getting the reference of a control inside a Data Template, handling the event and then using the sender is one of the available option. There is one more option that you can try: in .xaml: <toolkit:DataGrid Name="datagrid" Margin="0,0,0,28"