Preparation for complex WPF application Design RRS feed

  • Question

  • Hi

    We are very small organization working on .NET applications with very little knowledge of Architectures (DAL, BLL etc.)
    We have existing desktop application which is developed in WinForms. Now we want to revamp it in WPF with some additional functionality (like SharePoint communication, Windows Services etc.).
    Existing solution includes below logical layers (which are developed in very traditional ways)

    - BLL (Class Library)
    - DAL (Class Library)
    - Presentation Layer (WinForm Project)

    Now would like to go through MVVM design pattern in detail and want to revisit all the architecture concepts and design methodologies.
    So where I can find the detailed information/tutorial of the layers which I have to use in MVVM pattern as per the application types?
    What (where) I should learn before starting the revamp of this project?

    Any information or links will be very helpful.

    Thanks in advance for your responses.


    Wednesday, December 16, 2015 7:34 AM


  • Hi Somnath,

    The wpf side of things is potentially just the front end on your suite. You could potentially keep your dal etc and just switch out the front end for a wpf project.

    MVVM is a front end pattern. You can easily find a stack of articles describing mvvm. If you don't know which to start with just take a quick look through this page


    If you consider the diagram from there:

    Notice that the wpf mvvm stuff ends with a vague "Business Logic and Data" in the Model.

    Basically, the Model is however your data comes.

    The view is "dumb" in that it's job is the displaying of stuff. You will have little to no logic in there and mostly markup. The ViewModel layer is where your logic goes. Although it can of course be called from a ViewModel class rather than all in that.

    The job of the ViewModel is to act as an adapter between the View (which presents the data to the User) and the Model which is how it interacts with data.

    That's from an article about PRISM which is a framework from the MS patterns and practices team. I prefer MVVM Light. PRISM is being revamped for v6 and I've not really looked at that. V5 uses bridging objects for things like the event aggregator and the regions and containers stuff is usually far more complex than you need in a LoB app. If you build a product you sell as components to many customers who have different customisation for their components then MEF, Unity and composition by configuration is kind of useful. Otherwise, not so much.


    With WPF there is a LOT to learn before you start out but the thing to focus on first is the loose coupling between view and viewmodel which is enabled by WPF bindings and commands.

    I have a bunch of articles which are about wpf and mvvm in one way or another from super simple beginners mvvm introduction to pretty complicated working mvvm + entity framework sample.

    You can find them off my user page on the TnWiki


    Validation is one of the things I would flag up. There are a number of approaches possible. I recommend the inotifydataerror approach and I like dataannotations for the basic stuff because it's metadata based.This article introduces mvvm with ef


    That ( and the linked articles ) will give you some ideas on how you can structure a single window wpf app.

    This adds validation and moves editing out of the datagrid into an overlay.


    Obviously, that layout for editing is more suited to admin maintenance. There's only so much you can cram into each step without totally losing readers.

    This answers the common questions on what you do instead of events:


    My fellow TnWiki councillor XAML guy has some articles about mvvm amongst his wpf ones.

    Such as


    And if you're totally new to wpf you might find some stuff about layout interesting. Think in terms of everything flowing - more like html than winforms.


    I suggest you start digging through that lot.

    Come back with more specific questions.

    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Wednesday, December 16, 2015 8:50 AM