【问题标题】:Xamarin MVVM update list from other Viewmodel来自其他 Viewmodel 的 Xamarin MVVM 更新列表
【发布时间】:2017-04-18 15:38:58
【问题描述】:

我在 Xamarin 跨平台工作 安卓 我有 2 个视图模型 -MyTeamVM -CertificatesVM

MyTeamVm 是一个列表视图,我可以在其中点击一个人。单击后,我将转到 CertificatesVM,在那里我将看到被单击人员的证书。 问题是我第一次单击人员时一切正常,因为程序转到:(这是在证书VM中)

protected override async Task InitializeAsync()
        {
            var user = _userDataService.GetSelectedUser();
            Certificates = (await _earnedCertificateDataService.GetCertificateForUserAsync(user.Id));
        }

但是当我返回 MyTeamView 并选择其他人时,他不会更新列表。我有一个

public MvxCommand ReloadCertificates
        {
            get
            {
                return new MvxCommand(async () =>
                {
                    var user = _userDataService.GetSelectedUser();
                    Certificates = (await _earnedCertificateDataService.GetCertificateForUserAsync(user.Id));
                });
            }
        }

但它不起作用。

有人可以帮帮我吗?

【问题讨论】:

    标签: c# android xamarin mvvm


    【解决方案1】:

    【讨论】:

    • 我正在使用 Xamarin 本机并在我的视图模型中使用它,但我遇到错误:名称消息中心不存在。我需要添加参考吗?
    猜你喜欢
    • 2012-04-21
    • 1970-01-01
    • 1970-01-01
    • 2020-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多