How to implement IsEnabledChanged of silverlight dataform using MVVM

后端 未结 2 493
走了就别回头了
走了就别回头了 2021-01-27 19:32

I am looking for an example of how to implement the property IsEnabledChanged of the dataform using MVVM light, I set up the triggers but not sure about the implementation. So,

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-27 20:22

    EventTrigger only deals with routed events (see documentation). As you dealing with a dependency property changed event the EventTrigger simply does not recognize it.

    So from what I can see using code behind is the only way of achieving the functionality you require. Also you are dealing with a functionality that belongs to the view and is bound to the control you are using (the DataForm in this case). Therefore, it would be contra-productive to pull that dependency into the view model, as the view model should be independent form any given implementation of the view - i.e. the goal is to design your view model so that it can be used independent from the view and the controls uesed therein.

提交回复
热议问题