Issue binding to MVXSpinner after upgrading to Mvvmcross v4.0.0-beta3

孤街醉人 提交于 2019-12-11 12:25:40

问题


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);                
        }
    }

回答1:


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



来源:https://stackoverflow.com/questions/32718037/issue-binding-to-mvxspinner-after-upgrading-to-mvvmcross-v4-0-0-beta3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!