Prism Demo系列(八) Prism架构剖析:08-ViewModelLocator

本文主要介绍了Prism架构中的ViewModelLocator,作为ViewModel系统的一种实现方式,它负责定位和绑定ViewModel到View。文章通过一个简单的工程实例,详细阐述了App.xaml、App.xaml.cs、Bootstrapper.cs、MainWindow.xaml.cs的默认设置,以及MainWindow.xaml和MainWindowViewModel.cs的代码实现。最终展示了运行结果和流程分析,解释了View如何通过ViewModelLocator与ViewModel进行数据绑定,从而显示"Prism Unity Application"。
摘要由CSDN通过智能技术生成

一、简介

什么是ViewModel?自己百度下MVVM吧。

什么是ViewModelLocator?意思是ViewModel系统、或ViewModel定位,说白了,就是介绍ViewModel。

工程目录:

你可以参考https://www.cnblogs.com/bjxingch/articles/9562542.html

二、举例

1、App.xaml、App.xaml.cs、Bootstrapper.cs、MainWindow.xaml.cs采用默认值。

2、MainWindow.xaml:

<Window x:Class="ViewModelLocator.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我爱AI

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值