实例介绍
MVVM是Model、View、ViewModel的简写,这种模式的引入就是使用ViewModel来降低View和Model的耦合,说是降低View和Model的耦合。也可以说是是降低界面和逻辑的耦合,理想情况下界面和逻辑是完全分离的,单方面更改界面时不需要对逻辑代码改动,同样的逻辑代码更改时也不需要更改界面。同一个ViewModel可以使用完全不用的View进行展示,同一个View也可以使用不同的ViewModel以提供不同的操作。
【实例截图】
【核心代码】
969210MVVMTest
└── MVVMTest
├── CommandTest
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── bin
│ │ └── Debug
│ │ ├── CommandTest.exe
│ │ ├── CommandTest.pdb
│ │ ├── CommandTest.vshost.exe
│ │ ├── CommandTest.vshost.exe.manifest
│ │ ├── de
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── en
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── es
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── fr
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── it
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ja
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ko
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── MyMVVM.dll
│ │ ├── MyMVVM.pdb
│ │ ├── System.Windows.Interactivity.dll
│ │ ├── System.Windows.Interactivity.xml
│ │ ├── zh-Hans
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ └── zh-Hant
│ │ └── System.Windows.Interactivity.resources.dll
│ ├── CommandTest.csproj
│ ├── obj
│ │ └── Debug
│ │ ├── App.g.cs
│ │ ├── App.g.i.cs
│ │ ├── CommandTest.csproj.FileListAbsolute.txt
│ │ ├── CommandTest.csproj.GenerateResource.Cache
│ │ ├── CommandTest.csprojResolveAssemblyReference.cache
│ │ ├── CommandTest.exe
│ │ ├── CommandTest.g.resources
│ │ ├── CommandTest_MarkupCompile.cache
│ │ ├── CommandTest_MarkupCompile.i.cache
│ │ ├── CommandTest.pdb
│ │ ├── CommandTest.Properties.Resources.resources
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ └── View
│ │ ├── MainWindow.baml
│ │ ├── MainWindow.g.cs
│ │ └── MainWindow.g.i.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── View
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ └── MainWindowViewModel.cs
├── DataBinding
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── bin
│ │ └── Debug
│ │ ├── DataBinding.exe
│ │ ├── DataBinding.pdb
│ │ ├── DataBinding.vshost.exe
│ │ ├── DataBinding.vshost.exe.manifest
│ │ ├── de
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── en
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── es
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── fr
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── it
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ja
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ko
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── MyMVVM.dll
│ │ ├── MyMVVM.pdb
│ │ ├── System.Windows.Interactivity.dll
│ │ ├── System.Windows.Interactivity.xml
│ │ ├── zh-Hans
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ └── zh-Hant
│ │ └── System.Windows.Interactivity.resources.dll
│ ├── DataBinding.csproj
│ ├── Model
│ │ └── TestData.cs
│ ├── obj
│ │ └── Debug
│ │ ├── App.g.cs
│ │ ├── App.g.i.cs
│ │ ├── DataBinding.csproj.FileListAbsolute.txt
│ │ ├── DataBinding.csproj.GenerateResource.Cache
│ │ ├── DataBinding.csprojResolveAssemblyReference.cache
│ │ ├── DataBinding.exe
│ │ ├── DataBinding.g.resources
│ │ ├── DataBinding_MarkupCompile.cache
│ │ ├── DataBinding_MarkupCompile.i.cache
│ │ ├── DataBinding_MarkupCompile.lref
│ │ ├── DataBinding.pdb
│ │ ├── DataBinding.Properties.Resources.resources
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ └── View
│ │ ├── MainWindow.g.cs
│ │ └── MainWindow.g.i.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── View
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ └── MainWindowViewModel.cs
├── DataBindingTest
│ ├── Class1.cs
│ ├── DataBindingTest.csproj
│ └── Properties
│ └── AssemblyInfo.cs
├── EventBindingTest
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── bin
│ │ └── Debug
│ │ ├── de
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── en
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── es
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── EventBindingTest.exe
│ │ ├── EventBindingTest.pdb
│ │ ├── EventBindingTest.vshost.exe
│ │ ├── EventBindingTest.vshost.exe.manifest
│ │ ├── fr
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── it
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ja
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ko
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── MyMVVM.dll
│ │ ├── MyMVVM.pdb
│ │ ├── System.Windows.Interactivity.dll
│ │ ├── System.Windows.Interactivity.xml
│ │ ├── zh-Hans
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ └── zh-Hant
│ │ └── System.Windows.Interactivity.resources.dll
│ ├── EventBindingTest.csproj
│ ├── MainWindowViewModel.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── obj
│ │ └── Debug
│ │ ├── App.g.cs
│ │ ├── App.g.i.cs
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── EventBindingTest.csproj.FileListAbsolute.txt
│ │ ├── EventBindingTest.csproj.GenerateResource.Cache
│ │ ├── EventBindingTest.exe
│ │ ├── EventBindingTest.g.resources
│ │ ├── EventBindingTest_MarkupCompile.cache
│ │ ├── EventBindingTest_MarkupCompile.i.cache
│ │ ├── EventBindingTest.pdb
│ │ ├── EventBindingTest.Properties.Resources.resources
│ │ ├── MainWindow.baml
│ │ ├── MainWindow.g.cs
│ │ └── MainWindow.g.i.cs
│ └── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── MessageTest
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── bin
│ │ └── Debug
│ │ ├── de
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── en
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── es
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── fr
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── it
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ja
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ko
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── MessageTest.exe
│ │ ├── MessageTest.exe.config
│ │ ├── MessageTest.pdb
│ │ ├── MessageTest.vshost.exe
│ │ ├── MessageTest.vshost.exe.config
│ │ ├── MessageTest.vshost.exe.manifest
│ │ ├── MyMVVM.dll
│ │ ├── MyMVVM.pdb
│ │ ├── System.Windows.Interactivity.dll
│ │ ├── System.Windows.Interactivity.xml
│ │ ├── zh-Hans
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ └── zh-Hant
│ │ └── System.Windows.Interactivity.resources.dll
│ ├── Message
│ │ ├── ComputeMsgArgs.cs
│ │ └── MainRegister.cs
│ ├── MessageTest.csproj
│ ├── obj
│ │ └── Debug
│ │ ├── App.g.cs
│ │ ├── App.g.i.cs
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── MessageTest.csproj.FileListAbsolute.txt
│ │ ├── MessageTest.csproj.GenerateResource.Cache
│ │ ├── MessageTest.csprojResolveAssemblyReference.cache
│ │ ├── MessageTest.exe
│ │ ├── MessageTest.g.resources
│ │ ├── MessageTest_MarkupCompile.cache
│ │ ├── MessageTest_MarkupCompile.i.cache
│ │ ├── MessageTest_MarkupCompile.i.lref
│ │ ├── MessageTest_MarkupCompile.lref
│ │ ├── MessageTest.pdb
│ │ ├── MessageTest.Properties.Resources.resources
│ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ └── View
│ │ ├── ComputeWindow.baml
│ │ ├── ComputeWindow.g.cs
│ │ ├── ComputeWindow.g.i.cs
│ │ ├── MainWindow.baml
│ │ ├── MainWindow.g.cs
│ │ └── MainWindow.g.i.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── View
│ │ ├── ComputeWindow.xaml
│ │ ├── ComputeWindow.xaml.cs
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ ├── ComputeWindowViewModel.cs
│ └── MainWindowViewModel.cs
├── MVVMTest
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── bin
│ │ └── Debug
│ │ ├── de
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── en
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── es
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── fr
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── it
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ja
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ko
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── MVVMTest.exe
│ │ ├── MVVMTest.pdb
│ │ ├── MVVMTest.vshost.exe
│ │ ├── MVVMTest.vshost.exe.manifest
│ │ ├── MyMVVM.dll
│ │ ├── MyMVVM.pdb
│ │ ├── System.Windows.Interactivity.dll
│ │ ├── System.Windows.Interactivity.xml
│ │ ├── zh-Hans
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ └── zh-Hant
│ │ └── System.Windows.Interactivity.resources.dll
│ ├── Message
│ │ └── MainWindowMsg.cs
│ ├── Model
│ │ └── TestData.cs
│ ├── MVVMTest.csproj
│ ├── obj
│ │ └── Debug
│ │ ├── App.g.cs
│ │ ├── App.g.i.cs
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── MVVMTest.csproj.FileListAbsolute.txt
│ │ ├── MVVMTest.csproj.GenerateResource.Cache
│ │ ├── MVVMTest.csprojResolveAssemblyReference.cache
│ │ ├── MVVMTest.exe
│ │ ├── MVVMTest.g.resources
│ │ ├── MVVMTest_MarkupCompile.cache
│ │ ├── MVVMTest_MarkupCompile.i.cache
│ │ ├── MVVMTest_MarkupCompile.i.lref
│ │ ├── MVVMTest_MarkupCompile.lref
│ │ ├── MVVMTest.pdb
│ │ ├── MVVMTest.Properties.Resources.resources
│ │ └── View
│ │ ├── MainWindow.baml
│ │ ├── MainWindow.g.cs
│ │ └── MainWindow.g.i.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── View
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ └── MainWindowViewModel.cs
├── MVVMTest.sln
├── MyMVVM
│ ├── bin
│ │ └── Debug
│ │ ├── de
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── en
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── es
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── fr
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── it
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ja
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ko
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── MyMVVM.dll
│ │ ├── MyMVVM.pdb
│ │ ├── System.Windows.Interactivity.dll
│ │ ├── System.Windows.Interactivity.xml
│ │ ├── zh-Hans
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ └── zh-Hant
│ │ └── System.Windows.Interactivity.resources.dll
│ ├── ConfirmMsgArgs.cs
│ ├── DialogMsgArgs.cs
│ ├── DispatcherHelper.cs
│ ├── IMessageManager.cs
│ ├── IMessageRegister.cs
│ ├── MessageManager.cs
│ ├── MessageRegisterBase.cs
│ ├── MessageRegister.cs
│ ├── ModelBase.cs
│ ├── MsgActionInfo.cs
│ ├── MsgActionInfoGeneric.cs
│ ├── MsgArgs.cs
│ ├── MyCommand.cs
│ ├── MyCommandGeneric.cs
│ ├── MyEventCommand.cs
│ ├── MyMVVM.csproj
│ ├── NotifyObject.cs
│ ├── obj
│ │ └── Debug
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── MyMVVM.csproj.FileListAbsolute.txt
│ │ ├── MyMVVM.csprojResolveAssemblyReference.cache
│ │ ├── MyMVVM.dll
│ │ └── MyMVVM.pdb
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── StringArgs.cs
│ ├── ViewModelBase.cs
│ ├── ViewModelInfo.cs
│ └── ViewModelManager.cs
├── StudentCommandTest
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── bin
│ │ └── Debug
│ │ ├── de
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── en
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── es
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── fr
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── it
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ja
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── ko
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ ├── MyMVVM.dll
│ │ ├── MyMVVM.pdb
│ │ ├── StudentCommandTest.exe
│ │ ├── StudentCommandTest.pdb
│ │ ├── StudentCommandTest.vshost.exe
│ │ ├── System.Windows.Interactivity.dll
│ │ ├── System.Windows.Interactivity.xml
│ │ ├── zh-Hans
│ │ │ └── System.Windows.Interactivity.resources.dll
│ │ └── zh-Hant
│ │ └── System.Windows.Interactivity.resources.dll
│ ├── obj
│ │ └── Debug
│ │ ├── App.g.cs
│ │ ├── App.g.i.cs
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── MainWindow.g.i.cs
│ │ ├── StudentCommandTest.csproj.FileListAbsolute.txt
│ │ ├── StudentCommandTest.csproj.GenerateResource.Cache
│ │ ├── StudentCommandTest.csprojResolveAssemblyReference.cache
│ │ ├── StudentCommandTest.exe
│ │ ├── StudentCommandTest.g.resources
│ │ ├── StudentCommandTest_MarkupCompile.cache
│ │ ├── StudentCommandTest_MarkupCompile.i.cache
│ │ ├── StudentCommandTest_MarkupCompile.lref
│ │ ├── StudentCommandTest.pdb
│ │ ├── StudentCommandTest.Properties.Resources.resources
│ │ └── View
│ │ ├── MainWindow.baml
│ │ ├── MainWindow.g.cs
│ │ └── MainWindow.g.i.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── StudentCommandTest.csproj
│ ├── View
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ └── MainWindowViewModel.cs
├── StudyDataBinding
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── obj
│ │ └── Debug
│ │ ├── App.g.i.cs
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── MainWindow.g.i.cs
│ │ ├── StudyDataBinding_MarkupCompile.i.cache
│ │ └── View
│ │ └── MainWindow.g.i.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── StudyDataBinding.csproj
│ └── View
│ ├── MainWindow.xaml
│ └── MainWindow.xaml.cs
└── StudyEventBindingTest
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── obj
│ └── Debug
│ ├── App.g.i.cs
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── MainWindow.g.i.cs
│ └── StudyEventBindingTest_MarkupCompile.i.cache
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── StudyEventBindingTest.csproj
137 directories, 352 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论