Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a window in WPF which have textbox like

StockName
StockGroup
Quantity
Rate
Unit

Now i dont want to write any code in Code Behind but i want to create a class and any thing i modify in this window should be reflected in that class

When i click on the save button in my window, all the datas should be inserted into the database from the class.. HOw can i do that..

When i have seen some MVVM Projects i got confused.. Can anyone give me a simple example of MVVM in WPF
Posted

If you have implemented MVVM correctly, your data model should contain the 'edited' values and you should just be able to save them to the database.

Here are a couple of good startup links on MVVM
WPF: MVVM (Model View View-Model) Simplified[^]
WPF/MVVM Quick Start Tutorial[^]
 
Share this answer
 
Comments
Simon Bang Terkildsen 8-Oct-11 5:25am    
great links
Abhinav S 8-Oct-11 5:28am    
Thank you.
If you look at the code for Depends4Net - Part 1[^] - you'll find a straightforward MVVM implementation that does not use a bunch of external libraries to build an MVVM type of application.

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Simon Bang Terkildsen 8-Oct-11 5:26am    
My 5
Espen Harlinn 8-Oct-11 5:30am    
Thank you, Simon!
Abhinav S 8-Oct-11 5:28am    
Useful. My 5!
Espen Harlinn 8-Oct-11 5:30am    
Thank you, Abhinav!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900