Bind data of custom object to TextView in MvvmCros

2019-07-18 09:14发布

问题:

   I have one custom object in my ViewModel.I want to bind only one of its member to textview in my droid view.

I want to bind only string member of that object to textview Currently I am doing this.

   local:MvxBind = "Text Myobject.ItsMember"

Is it ok? Or am I wrong?

Or Can I do Like this?

   local:MvxBind = "ItemsSource MyObject ; Text ItsMember"

How can I achieve this?

回答1:

local:MvxBind = "Text MyObject.ItsMember" is perfectly fine. Just make sure your spelling and capitalization are correct. Also, ItsMember should be a string or have a valid value returned as ToString.

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        local:MvxBind="Text MyObject.ItsMember"
        />


标签: mvvmcross