-1

it is said, that MVVM enables UI developers and back-end developers to collaborate easily when developing.

WPF allows to separate the implementation of the appearance using XAML markup from the implementation of application behavior (code-behind) using managed programming language.

It sounds similar too similar to me. Can anyone explain to me what are the relationships between MVVM, WPF and XAML?

Thank you!

Very Curious
  • 881
  • 3
  • 26
  • 50
  • 1
    Have you asked google about this? – dev hedgehog Nov 09 '13 at 17:10
  • 1
    It's quite simple really... XAML is the markup language that WPF uses to declare UI elements and MVVM is an architectural pattern that promotes separation of concerns and works extremely well with WPF development. – Sheridan Nov 09 '13 at 17:59

2 Answers2

3

WPF is the technology. It is the set of classes that provide for user interface development in .NET, and it is the replacement for Winforms.

XAML is the HTML of WPF. It is the markup language used for WPF. It defines what the user sees, such as a textbox and a label, and what locations they are in. This includes styling. XAML uses the classes defined by WPF.

Then you have a model. This is all the backend knowledge and logic you have to have. Your credit card transactions would live in the model, for instance.

Then you have a view model (MVVM is model-view-viewmodel). Your view model is the layer between your model and view. It helps accommodate your model to your view. The ViewModel's main job is to provide public properties for the UI (XAML). These public properties, which you define, are for the data you want the listboxes etc. to use, and for the code you want to be run when the button is clicked.

Inside of the XAML, you specify which properties of the ViewModel you want to bind to. In MVVM and WPF, the ViewModel is coupled with the UI/XAML, but the model is kept abstracted.

So, to make a long story short:

  1. XAML is like HTML
  2. ViewModels provide the data so XAML knows what to populate its UI controls with.
  3. WPF is only the collection of classes that XAML uses (and the codebehind, but usually not the ViewModel).
Millie Smith
  • 4,536
  • 2
  • 24
  • 60
0

Well in layman's term, WPF is the technology (i.e. Winforms, WPF, Webforms), XAML is the Mark up language for View or UI, and MVVM is the pattern.

Lance
  • 2,774
  • 4
  • 37
  • 57