Silverlight 4: Reliable Command with RequeryS Proposed Functionality?

One of the main issues that I encountered in Silverlight is the lack of reliable Commanding support (ala WPF). More specifically, it is very difficult for me to apply the MVVM pattern cleanly and with reasonable encapsulation due to the requirement to manually call RaiseCanExecuteChanged () for any property that may affect the state of the command.

As an example, I have a parent / child View link to the parent / child ViewModel. The parent view is bound to the parent ViewModel command. The parent view has several child views, each of which is a user control that contains a number of built-in controls (text fields, drop-down lists, etc.) that are tied to the model of the child view.

The state of the parent command (that is, whether it can be executed) is based on the state of each of the child controls. For example, all text fields for all child usercontrols must have valid values. This requires the properties that these controls bind each call to RaiseCanExecuteChanged (), which means that they must have knowledge of either ICommand itself or a delegate to call the RaiseCanExecuteChanged () method.

Entering a command or a delegate seems to me wrong, especially in situations more complex than described above, for example, when there are 3+ levels of controls, and these links should be passed completely down the chain. This is also a bit more housekeeping, since each time a child receives a copy, an additional step is required to add a team or delegate.

, Silverlight CommandManager.RequerySposed, WPF.

, , RequerySposed Silverlight ( ), . , .

Silverlight?

+3
1

, , - Laurent Bugnion MVVM Light framework (http://blog.galasoft.ch/archive/2009/09/27/mvvm-light-toolkit-messenger-v2-beta.aspx).

, , . , , RaiseCanExecuteChanged().

, MVVM Light , . .

, .

+4

Source: https://habr.com/ru/post/1783704/


All Articles