开发者

Starting WPF MVVM. Use a framework? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_如何学Python

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question

I took a look at some questions here at stack overflow like this & mix10 building your own mvvm framework

I wonder if as a beginner its better to start from scratch (but I heard from the vid, its not recommended) or use a framework

also which is more suited as a beginner framework to learn? I find that after reading quite a few articles or even tutorial videos I am still quite lost. I may get parts here and there but still not there.

caliburn micro a smaller framework easy to learn? or something from microsoft like MVVM toolkit or Unity/Prism (whats the diff bet all this MS frameworks btw)? MVVM Light?


IMO, there no need to use a framework. MVVM is just a way of doing things.

For a start, you only need a RelayCommand class, so you can bind commands to your viewModel. You can download it from Josh Smith MVVM Foundation

Then when you are more advanced you can add other classes like:

  • ObservableObject: This is intended to be the base class for ViewModel types, or any type that must provide property change notifications. It implements INotifyPropertyChanged and, in debug builds, will verify that all property names passed through the PropertyChanged event are valid properties. This class used to be called ViewModelBase.

  • Messenger: The Messenger class is a lightweight way of passing messages between various ViewModel objects who do not need to be aware of each other. This is based on the Mediator implementation created by Marlon Grech and Josh Smith, as seen on Marlon's blog.


My $0.02 :

I've started using WPF / the Mvvm-pattern a few weeks ago and one route I can definitely recommend is first starting a test-project, reading a lot about mvvm, and trying to implement it yourself (even if it's just by using parts of other people's stuff). Implement something, read some more, go back and change stuff, and then read some more.

Do this for the first 2 weeks and you'll get an idea of what it's actually all about, you'll see some problems and find some solutions, etcetera. Basicly this will get the mvvm-idea in your fingers and give you some hands-on experience.

Then if you like you can throw away your test-project, decide wether or not to really start writing your own stuff or using an existing kit, and probably have more appreciation and understanding for the way existing kits work.

I ended up not using an existing kit but my own very simple implementation since I didn't need much complexity for my project, but I did get a lot more appreciation for some implementations I've seen discussed on the interwebs.

Edit: When I talk about "two weeks" I mean "two weeks of sparetime" which is about 25 real hours ;-)


From my point of view, If you are learning WPF/MVVM for yourself then you must learn MVVM thoroughly and try to build a framework from scratch(As explained by Eduardo)

But if you are starting with a Commercial project or Enterprise application then you must consider using some established framework like PRISM or Caliburn or MVVM Light Toolkit.

We had not used any framework in my first project and I somewhat regret that. Although nothing went wrong and it was not very tough to build your own framework(as Eduardo said) but it took us a lot of time and a no. of iterations in finalizing various base classes etc. Also, we couldn't take the advantage of various things which are already implemented in some of these frameworks(as we didn't knew about them at all).


I think it will be better to start with a hello world application. Slowly get acustomed with the controls (listview, gridivew...) and then basic wpf concepts (binding, templates, triggers...). After that you can move on to MVVM.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜