This example shows how to create a ViewModel and a View within the MVVM pattern and WPF, and how to bind the two together, so that each is updated whenever the other is changed.
Binding a String in the ViewModel to a TextBox in the View
A DependencyProperty can be easily added by using the wpfdp code snippet (type wpfdp, then press the TAB key twice), however, the code snippet is not type safe, and will not compile under Option Strict On.
Note that this is a very rudimentary way to implement MVVM and databinding. A more robust practice would be to use a platform like Unity to "inject" the ViewModel into the View.
This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0