MVVMCross - 广播消息的工作原理是List <string>,但不适用于List <t>

时间:2017-01-30 22:00:06

标签: xamarin xamarin.ios mvvmcross

我将按钮的页面背景图像绑定到List元素。当在其他页面上更改这些图像时,我使用事件来更新以前的页面。当列表是字符串类型时,这可以正常工作,但当列表类型为类T时,它不起作用。

查看:

private readonly IMvxMessenger mvxMessenger;
        #pragma warning disable CS0414
        private MvxSubscriptionToken onUserImageUpdate;
        #pragma warning restore CS0414

        private List<string> _userImages;
        public List<string> UserImages
        {
            get { return _userImages; }
            set
            {
                _userImages = value;
                RaisePropertyChanged(() => UserImages);
            }
        }
public ICommand ReloadViewCommand
        {
            get
            {
                return new MvxCommand(() =>
                {
                    RaisePropertyChanged(() => UserImages);
                });

            }

        }
public ViewModel()
        {
            onUserImageUpdate = mvxMessenger.SubscribeOnThreadPoolThread<UserPhotoNotification>(OnUserImageUpdate);
        }

void OnUserImageUpdate(UserPhotoNotification message)
        {
            UserImages = message.Images;
        }

视图模型

private List<abc> _userImages;
        public List<abc> UserImages
        {
            get { return _userImages; }
            set
            {
                _userImages = value;
                RaisePropertyChanged(() => UserImages);
            }
        }

列表&#39; UserImage&#39;这一切都正常。是字符串类型。如果我将UserImage更改为T类型,

<div id="IA"><a class="addProdClick">Get a Quote</a></div>
<div id="MP"><a class="addProdClick">Get a Quote</a></div>
<div id="GS"><a class="addProdClick">Get a Quote</a></div>

然后即使通过调试器可以看到更改,这些更改也不会在屏幕上更新。

0 个答案:

没有答案