I have a DataGrid which contains some Product details , i need to load the product details into some textboxes when i double click on a particular product in the datagrid.
Thanks in advance.
I have a DataGrid which contains some Product details , i need to load the product details into some textboxes when i double click on a particular product in the datagrid.
Thanks in advance.
Welcome to StackOverflow! Usually people won't answer questions without the following.
That said, I will give you a demo of what you're asking for.
Here is the XAML
Next is our ViewModel. If the view is the frosting on the cake then you can think of the view model as the cake around the pudding. Your view model is where your logic lives. It will do sorting, crunching and other stuff.
Finally there is your Model. This is your actual data. This, yes this, is your pudding.
Finally here is the expected result
In this first image we see our grid loaded up with its new data
If you click on a row you will see it's data populate the two text boxes on the side.
Finally if you change the data in the text boxes you will see it update in the grid immediately.
And that's it! A complete MVVM datagrid to text box and back solution. Hope this helps. Please remember what I said about what is expected from you as a question asker and have fun! Welcome to WPF and MVVM.