问题升级到V4.0.0 Mvvmcross-β3后结合MVXSpinner [英] Issue binding to MVXSpinner after upgrading to Mvvmcross v4.0.0-beta3

查看:115
本文介绍了问题升级到V4.0.0 Mvvmcross-β3后结合MVXSpinner的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了我所有的Mvvmcross库到版本4.0.0-beta3版,它看起来像它可能已经打破了MVXSpinner的结合。

我得到在输出以下消息:

MvxBind:警告:5.40无法创建目标绑定的SelectedItem为SelectedColor结合

下面是XML:

 < MvxSpinner
               机器人:layout_width =match_parent
               机器人:layout_height =WRAP_CONTENT
               机器人:ID =@ + ID / colorSpinner
               机器人:spinnerMode =下拉菜单
               机器人:layout_below =@ ID / maintoolbar
               本地:MvxBind =的ItemsSource ColorList;的SelectedItem SelectedColor/>

下面是视图模型:

 公共HomeViewModel(IKrizzmaService服务,IMvxMessenger信使)
        :基地(服务,信使)
    {
        SelectedColor =蓝;
    }    私人静态字符串[] = _colorList {黄色,棕,白,蓝,橙色,红色,绿色,紫};
    公共字符串[] ColorList
    {
        {返回_colorList; }
    }    私人字符串_selectedColor;
    公共字符串SelectedColor
    {
        {返回_selectedColor; }
        组
        {
            _selectedColor =价值;
            RaisePropertyChanged(()=> SelectedColor);
        }
    }


解决方案

呼叫 MvxAppCompatSetupHelper.FillTargetFactories Setup.cs FillTargetFactories()

I just updated all of my Mvvmcross libraries to version 4.0.0-beta3 and it looks like it may have broken the binding of the MVXSpinner.

I get the following message in the output:

MvxBind:Warning: 5.40 Failed to create target binding for binding SelectedItem for SelectedColor

Here is the xml:

<MvxSpinner
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:id="@+id/colorSpinner"
               android:spinnerMode="dropdown"                 
               android:layout_below="@id/maintoolbar"
               local:MvxBind="ItemsSource ColorList; SelectedItem SelectedColor" />

Here is the ViewModel:

    public HomeViewModel(IKrizzmaService service, IMvxMessenger messenger)
        :base(service, messenger)
    {
        SelectedColor = "Blue";
    }

    private static string[] _colorList = { "Yellow", "Brown", "White", "Blue", "Orange", "Red", "Green", "Purple" };
    public string[] ColorList
    {
        get { return _colorList; }
    }

    private string _selectedColor;
    public string SelectedColor
    {
        get { return _selectedColor; }
        set
        {
            _selectedColor = value;
            RaisePropertyChanged(() => SelectedColor);                
        }
    }

解决方案

Call MvxAppCompatSetupHelper.FillTargetFactories from your Setup.cs's FillTargetFactories()

这篇关于问题升级到V4.0.0 Mvvmcross-β3后结合MVXSpinner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆