-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native Support of MVVM Pattern #434
Comments
There's all the key MVVM ingredients needed: Could you explain what you mean by "native support" ? |
@dotMorten i meant built-in MVVM Pattern, i know there are some useful classes to make your application MVVM based, but what i mean a ready made MVVM structure of the project, and simplify the process of binding like a command for instance. and the validation process and the navigation between the windows or pages no need for injecting libraries that change their code every release, that have tons of bugs and messy code structure ASP.NET MVC for example, is a perfect example for what i mean. |
@AhmedAbuelnour Is there any reason you can't just use Prism, MVVMLight, MvvmCross etc? Why would it need to be dictated by the platform? |
There are some lakes API with the following |
Frame and NavigationService is already there in WPF, including forwarding data. Command binding is also already there with ICommand and many controls having Command properties to bind to. So am I right in saying you just want to be able to bind an event directly to a method? (similar to UWP's x:Bind method binding?) |
this should be more like replacing wpf's Binding with UWP's x:Bind and unify the binding experience for both platforms |
@dotMorten Not just this but basicly the current binding implementation doesn't support input Validation hook, so basicly in the bindings you have to add explicitly rules for data Validation. Of Course there is a Workaround for this, but we are again at the Point where the platform doesn't support it out of the box. And then we come to the really tricky part the command revalidation. There is currently no Default implementations to detect Content changes on Elements which are not present on the ViewModel Level, so if you want to use the commandparameter property of Control you have to still Mirror the value down to ViewModel Level, or you have hook in the CommandManager.RequerySuggested which is also not the best. |
I'd frame it not as "add 'native' support for MVVM" but more as: "please please please eliminate the tedium and repetitive (and error-prone, and brittle) work we need to do in order to implement MVVM". A few things I can think of right now off the top-of-my-head:
Another problem with MVVM-in-practice is a lot of tutorials and whitepapers are too simplistic (e.g. singleton views with singleton viewmodels) and/or use Edit: Now that I think about it, I'm actually starting to feel a disdain for MVVM because it has a lot of inherent problems (difficult to compose; the inevitability of having to use a common I know a Redux/React-style refreshing of the entire UI state (yes, I know it's optimized) wouldn't scale for data-heavy scenarios, but I am really drawn towards the idea of enforced unidirectional data-flow - which would be straightforward to implement in MVVMs if we could have succint "split" bindings in XAML such that the Property-Getter is used for display, but any changes back to the ViewModel have to go through an action-dispatch system like Redux/React - the problem is doing this correctly would be even more tedious than bidrectional INPC because we'd have to manually define all those separate Actions as separate types and members (or settle for something weakly-typed and without compile-time assurances of correctness). |
I really wish to see that one day, we have a native support for MVVM Pattern in all XAML based applications (Xamarin , UWP , and WPF) like you did in ASP.NET MVC
We need a native support of MVVM Pattern to make it more clean and well structured and no need for injecting tons of services and code editting to set up the project to be ready to be used.
The text was updated successfully, but these errors were encountered: