Winforms to WPF Patterns
For various reasons( mainly time ) we have to create a new application with Winforms. I have a feeling that people higher up in the hierarchy may want to change that to a WPF application( or something else) in a year or so to be able to present a more good looking UI. But right now we are stuck with Winforms. We will be using Entity Framework for O/R mapping.
My question is if someone can recommend a pattern to use in the Winforms application so the work to go from Winforms to WPF will be as easy as possible. We also want to be able to change the 'View' part in the Winforms app to another Winforms design. I have been looking on MVP for the winforms application. I don't have much experience with WPF so I don't if this is possible, I've seen that MVVM seems to be popular with WPF.
I don't want to have to rewrite any business code. Ideally I would basically like to just change the 'View'-part from winforms to WPF. Or at least make that process as smooth as possible.
Any suggestions or recommendations would be very appreciated.
As already noted in the question, one of the distinguishing features of WPF compared to Winforms is the nearly ubiquitous MVVM design pattern. Although it is not possible to implement MVVM in Winforms exactly as it is usually done in WPF, adhering to its core ideas might nevertheless go a long way in making the overall object structure and interaction logic more aligned with WPF.
When doing MVVM properly, all business code gets decoupled into a separate layer so you don't need to rewrite any of it - just create the viewmodels and the views and pipe them together with your existing business objects.
My suggestion is to implement a small prototype application in WPF to get an idea how MVVM works in practice and then decide if and how to translate those concepts into the world of Winforms. This requires some effort though, both in coding and in analysis, but I doubt a Winforms application could be aligned to WPF even at basic levels without understanding what WPF and MVVM are about.
MVVM (Model-View-ViewModel) Pattern For Windows Form Applications, using C#
链接地址: http://www.djcxy.com/p/84594.html上一篇: 背景皮肤和wpf中的固定布局
下一篇: Winforms到WPF模式