I'm in a situation where for the past year I've been developing heavily in Silverlight using the MVVM pattern. I've sold my project manager numerous times on the greatness of MVVM through its separation of duties, and have had 开发者_JAVA百科some great successes where I've re-written views in a day, rather than re-writing the app in a week.
Recently we've had a directive to 'go mobile' that is compatible with as many mobile browsers as possible (eg. Not Silverlight). My project manager is under the assumption, based on my earlier work that I can simply write a new 'view' for mobile apps.
Question:
Is there a way to be able to apply my existing MVVM code to a mobile front-end that doesn't consist of Silverlight?
I don't think so. MVVM relies on constant interaction between the view and the viewmodel through notifications, commands, etc. Since your code is in .NET, there's no chance to run it on the client side in a web application.
You could however use some MVVM javascript framework like KnockoutJS in combination with some MVC framework (ASP.NET MVC 2 would be the easiest transition). This is the most similar approach I can think of, but you need to migrate your current applications.
精彩评论