silverlight - What is the real advantage of keeping code out of the XAML code behind? -
There are many attempts in the Silverlight community to keep XAML codes behind the code as code-free as possible What is the real motivation?
For example, what is the use of command instead of an event handler? If I have
& lt; Button x: name = "save button" content = "save" click = "savebutton_link" /> ... Private Zero SaveButton_Click (Object Sender, RoutedEventArgs e) {_myViewModel.SaveChanges (); }
So why do you like it?
& lt; Button x: name = "save button" content = "save" command = "{save compulsory}" / & gt;
Where clearly the SaveCommand
is going to call SaveChanges ()
in my visual model .
This can lead to situations where the scene is 100% XAMML, and the connection between the visual and visual model is done entirely through bondage while giving the visual model in the XAML. goes. Sure it is clear, but what else is it? Flexible? Why? The scene still needs to work with the proper ViewModel, so if the relationship between the two exists and it is contained, why not make it more clear? It's also the loss of losing time support compilation. If I hook my button up to an event handler which is not present then the compiler will tell me this if I will not bind a non-existent order.
This unit is tested and / or TDD is easy by using MVVM and commanding, I must I can create the idea model and order the TDD style and actually can test the XAML scene without any visual reasoning.
Comments
Post a Comment