Possible Duplicate:
Getting value of a PasswordBox that's inside a ListView
I have a ListView that has a TextBox:
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Width="200" Name="tb" />
</DataTemplate>
</GridViewColumn.CellTemplate>
Can someone tell me how to get the value of tb for say ListViewItem no 3?
It easiest and most natural, from point of view of WPF, way is to use databinding, assigned to your control. For example:
Set
MyModelViewPropertyand text will appear onTextBox, change theTextBoxTextporperty and you model view property:MyModelViewPropertywill be changed. There is no need to get a value from control, that value will be pushed on you by Binding mechanism automatically. Here is a simple explanation of binding and how to implement it: Msdn Binding in WPFRegards.