Xamarin.forms prism中的xaml viewmodel声明

Xamarin.forms prism中的xaml viewmodel声明,xamarin.forms,prism,Xamarin.forms,Prism,我将PRISM与xamarin表单一起使用,我喜欢在XAML中声明我的viewmodels xmlns:local="clr-namespace:MyProyect.ViewModels" <ContentPage.BindingContext> <local:RegistroPageViewModel /> </ContentPage.BindingContext> 我的具体问题是:如果viewmodel有一个参数,我如何仍然使用XAML v

我将PRISM与xamarin表单一起使用,我喜欢在XAML中声明我的viewmodels

xmlns:local="clr-namespace:MyProyect.ViewModels" 

<ContentPage.BindingContext>
    <local:RegistroPageViewModel />
</ContentPage.BindingContext>
我的具体问题是:如果viewmodel有一个参数,我如何仍然使用XAML viemodels的声明?如何在XAML声明中传递参数


提前通知XAML了解ViewModel,启用和。文档提供了如何正确启用和使用它们

XamlC检查一般编译时错误,如属性名和打开-关闭匹配标记等


编译绑定检查绑定的任何属性是否存在。您可以使用视图模型定位器(
ViewModelLocator.AutowireViewModel=“True”
)为您创建视图模型,并自动注入所有依赖项


将视图模型设置为设计数据上下文(
d:DataContext={d:DesignInstance local:RegistroPageViewModel}
)将为您提供intellisense功能。

您可能希望在此处向上投票,并且链接的重竖琴问题:
public class RegistroPageViewModel : ViewModelBase
{
    public RegistroPageViewModel(INavigationService navigationService):base(navigationService)
    {
        registro = new RegistroInfo();
        Title = "Perfil de usuario";
    }