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
I agree with Justin.
But if for some reason binding to some property is problematic and you still need reference to a control inside data template in SILVERLIGHT ( above solution is suitable for WPF components ) you can do as follow:
TextBox textBox = null;
if (datagrid.SelectedItem != null)
textBox = datagrid.Columns[1].GetCellContent(datagrid.SelectedItem) as TextBox;
if (textBox != null)
MessageBox.Show(textBox.Text);