Fat Models, skinny ViewModels and dumb Views, the best MVVM approach?

前端 未结 2 1881
遥遥无期
遥遥无期 2020-12-02 12:26

Through generous help on this question, I put together the following MVVM structure which displays the changes of a model in real time in XAML (current date/time), very nice

2条回答
  •  天涯浪人
    2020-12-02 13:18

    I agree with Thomas. My advise to anyone on WPF architecturing would be:

    • Plain POCO entities with no INotifyPropertyChange, state tracking, BL, etc.
    • Simple and small ViewModels that notify Views just-in-time
    • Simple reusable UI with a smart navigation system that avoid complex data hierarchies and complex underlying ViewModels
    • MVVM with View First approach to keep dependencies simple
    • Async operations with Tasks or Rx
    • A simple theme
    • No complex robust UI, keep it simple, just take advantage of WPFs UI composition and binding capabilities
    • Don't hesitate to use code-behind to generate content dynamically (forms, lists etc) and save significant time on declarative eye configuration (applies to most cases) - and for me a must on 2015. Use extension methods to create a Fluent API for that.

提交回复
热议问题