【发布时间】:2020-02-27 22:30:29
【问题描述】:
我将 PRISM 与 xamarin 表单一起使用,并且我喜欢在 XAML 中声明我的视图模型,
xmlns:local="clr-namespace:MyProyect.ViewModels"
……
<ContentPage.BindingContext>
<local:RegistroPageViewModel />
</ContentPage.BindingContext>
所以我可以拥有 XAML 智能,在这个示例中,我的 RegistroPageViewModel 构造函数有一个参数,因为它需要基类,但我不知道如何在 xaml 中传递它
public class RegistroPageViewModel : ViewModelBase
{
public RegistroPageViewModel(INavigationService navigationService):base(navigationService)
{
registro = new RegistroInfo();
Title = "Perfil de usuario";
}
我的具体问题是:如果 viewmodel 有参数,我如何仍然使用 XAML viemodels 的声明?如何在 XAML 声明中传递参数?
提前考虑
【问题讨论】:
-
您可能想在此处投票并链接的 resharper 问题:stackoverflow.com/questions/36941300/…
标签: xamarin.forms prism