2017-01-31 188 views
4

訪問一個XAML頁面的代碼背後(Xamarin表格)視圖模型實例下面是Xamarin形式與棱鏡MVVM框架我的網頁的定義:如何棱鏡

<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的實例,在後面的代碼中與此頁面交互?

回答