MVVM - Presentation Model in Flex vs Presentation Model in Silverlight: advantages and disadvantages?

前端 未结 2 1760
眼角桃花
眼角桃花 2021-01-23 17:56

As it is said here:

http://houseofbilz.com/archives/2010/12/29/cross-training-in-silverlight-flexmvvm-vs-presentation-model/

\"If you do a Google search today fo

2条回答
  •  自闭症患者
    2021-01-23 18:11

    There are two things, really that make it more complicated:

    • Implementing INotifyPropertyChanged
    • Commands

    One thing you can do in Silverlight is use the "Property Weaver". It will do something similar to the [Binding] tag in Flex as it will automatically take public getter/setters and re-write them with the INPC pattern.

    As for commands, wrapping methods in DelegateCommands proves to be a lot of plumbing. There are several approaches to this. I like a convention-based approach, where you declare a public method named Execute_Something and the command Something is automatically created for you to bind to. Here and Here.

    Finally, binding in Flex is expression-based where as binding in Silverlight is purely declarative. I have some ideas for when we get C# v.Next and we might be able to do expression-based binding pretty easily.

提交回复
热议问题