i'm new to WPF and still learn on it. I create a sample application and connect to the database. After i select data to the database, i can show it into my datagrid. Now, my concern is i want to bind to textbox depends on the row from my datagrid.

so, whenever i click or select row in my datagrid, i bind the value to textbox. i already do some google and tried. but still failed. is there any solution? thanks.

here is my application picture.

how is the xaml look like to bind for example row no 3 to my textbox? is there any class i should implement? because in windows form i just need to call cellclick. thanks.

thanks for your answer. thats mean i have to implement a datagrid property in my code .cs, after that i alos change the .xaml? but do you have any sample code? thanks.
–
Alfred AngkasaOct 5 '12 at 7:28

1

You mentioned that you are new to WPF, so I highly recommend reading on MVVM Pattern (Model View ViewModel). I have added a code example to my answer that uses only xaml
–
doerigOct 5 '12 at 7:37

wait.. i got it.. thanks. How about if we change on the datagrid? i mean instead of bind, we also can change the value inside the datagrid.
–
Alfred AngkasaOct 5 '12 at 7:40

myDataGrid is the name of the datagrid. SelectedItem is a reference to the item that is currently selected in the grid. SelectedItem.Name is a arbitrary chosen Property. You can use any Property that is implemented in the class of the items that you have added to the grid
–
doerigOct 5 '12 at 7:43

now i understand. but how about by clicking the row in my datagrid, i also can edit/type, after that save to my database. is that possible?
–
Alfred AngkasaOct 5 '12 at 7:46