首页 文章

如何在Prism中的XAML页面代码(Xamarin Forms)中访问视图模型实例

提问于
浏览
4

以下是使用Prism MVVM框架的Xamarin Forms中我的页面的定义:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
             prism:ViewModelLocator.AutowireViewModel="True"
             xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps"
             x:Class="MyProject.UI.Modules.Views.MapPage">

.....
</ContentPage>

不幸的是,当绑定引脚等时,Xamarin映射不支持MVVM . 因此,我需要在页面后面的C#代码中进行一些代码更改 . 如何在后面的代码中访问与此页面交互的ViewModel实例?

1 回答

相关问题