Learning WPF and MVVM - best approach for learning

2019-01-20 23:15发布

I've got about three years c# experience. I'd like to learn some WPF and the MVVM pattern. There are a lot of links to articles on this site but I'm getting a little overwhelmed. Would a sensible approach for a begginer to be forget mvvm for a while and just quickly learn a bit a of WPF, then come back to MVVM?

I had a leaf through Application=Code+Markup - Charles Petzold in work today, it doesn't seem to mention MVVM (at least not in the index). I was pretty surprised by this as I thought MVVM was supposed to be the "lingua franca" of WPF?

Also I've just started working at a new company and they are using MVVM with WinForms, has anyone come across this before?

Can anyone recommend a book that will teach me both WPF and MVVM?

标签: wpf mvvm
8条回答
迷人小祖宗
2楼-- · 2019-01-20 23:28

I was told a few times that my MIX10 session was explaining the MVVM pattern well enough for beginners (even though some parts are actually quite advanced, so don't worry if you need to re-watch certain parts).

The session is at http://live.visitmix.com/MIX10/Sessions/EX14

Sorry for the self-promotion.

Cheers, Laurent

查看更多
聊天终结者
3楼-- · 2019-01-20 23:28

There aren't many books covering MVVM but there is one : Advanced MVVM

But there are lots of online resources and this one is a must read : WPF Apps With The Model-View-ViewModel Design Pattern

After that I suggest looking into frameworks like

查看更多
干净又极端
4楼-- · 2019-01-20 23:30

To do big things (like learning WPF + MVVM) it is better to break the task in smaller steps.

I think that the best approach in this situation is to start by learning the UI part of Wpf. Learn XAML syntax, the layout system, the available controls and forget about binding and how to deliver data to the controls.

Once you know the UI basics of Wpf then it is time to move to MVVM. Learn how bindings work and the MVVM pattern.

In this Web you can find a tutorial focusing on the hands on but with the theory available:

http://www.learnmvvm.com

查看更多
神经病院院长
5楼-- · 2019-01-20 23:32

Jason Dolinger has an excellent video on the subject. It steps you through the process moving from using code behind files to a full MVVM pattern including Dependency Injection and Testing.

Bill Steele did a 16 part "Soup-to-Nuts" webcast series on WPF. The links on the msevents site are broken. Here is a Google search to find them. This will help with the WPF learning curve. And he does NOT use any MV* patterns in his examples.

EDIT: The MSEvents links are working now, I am leaving the Google search as a backup.

Josh Smith also has an excellent article WPF Apps With The Model-View-ViewModel Design Pattern on MSDN.

Herding Code: Presentation Patterns with Jeremy Miller, Ward Bell, Rob Eisenberg and Glenn Block

MIX10:

And of course Reed Copsey's MVVM articles are worth a read as well.

查看更多
时光不老,我们不散
6楼-- · 2019-01-20 23:36

Here is a tutorial for MVVM http://www.codeproject.com/Articles/819294/Learn-WPF-MVVM-step-by-step-Basics-to-Advance-Leve which goes from basic to the advance level in 5 steps. So its like graduating from a 3 layer to full MVVM.

enter image description here

查看更多
相关推荐>>
7楼-- · 2019-01-20 23:40

It depends on your experience.

I personally felt that this was a lacking area in MVVM discussions, which was what led me to write my series on MVVM and WPF from a Windows Forms developer perspective.

I would not try to learn WPF without learning MVVM. You'll end up trying to "unlearn" many aspects, as WPF really doesn't make sense, completely, until you understand the separation of presentation and logic that's pervasive throughout the architecture. MVVM is really just extending this same separation into the application space.

As for "MVVM in Windows Forms" - a lot of people try to do this, but it's not really MVVM. In order to do "MVVM" you need access to a richer form of data binding than Windows Forms provides. "MVVM in Windows Forms" is really, typically, just Model-View-Presenter with a different name (riding the MVVM bandwagon, I'd guess), but not really the same as MVVM in WPF.

查看更多
登录 后发表回答