如何在我的应用程序中正确创建MVVM结构

如何在我的应用程序中正确创建MVVM结构

本文介绍了如何在我的应用程序中正确创建MVVM结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想问你如何在WPF中创建适当的MVVM结构以及将什么放到每个View,VieModel和Model中。我想了解创建MVVM结构的方法,然而,在阅读了大量的指南和论坛后,我感到困惑。我试图用PRISM教程做这件事 - 对我来说太重了,还有MVVM Light。接下来我找到了Caliburn Micro。好的,我会尝试使用其中一个但是......我不明白如何为我的应用程序实现MVVM。



我的应用程序有 - MainWIndow(使用MahhApps),带有TitleBar按钮,弹出按钮,LoginDialog和Dialogs。我有3个UserControls作为菜单 - 用于管理员,员工和SPOC。每个都不同。现在我有代码隐藏。对于每个按钮,对于每个文本框,对于每个保存,删除,清除,更新方法,我在代码隐藏中有代码。



我很困惑,因为它看起来很简单,但我想我看了太多的教程。



感谢您的任何建议。

Hi all,

I would like to ask you how to create proper MVVM structure in WPF and what to put to each View, VieModel and Model. I wanted to understand the way to create the MVVM structure, however, after reading the huge amount of guides and forums I'm confused. I was trying to do it with PRISM tutorial - too heavy for me, and with MVVM Light. Next I found Caliburn Micro. Okay, I will try to use one of those but.... I don't understand how can I implement MVVM for my app.

My app have - MainWIndow (using MahhApps) with TitleBar buttons, flyouts, LoginDialog and Dialogs. I have 3 UserControls as a Menu - for Admin, Employee and SPOC. Each is different. Now I have code-behind. For each button, for each textbox, for each save, delete, clear, update method I have code in code-behind.

I'm confused with that cuz it looks like it's simple, but I guess I saw too many tutorials.

Thank you for any suggestions.

推荐答案


这篇关于如何在我的应用程序中正确创建MVVM结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 19:29