Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MVVMCROSS Android版本内置复选框&;开关绑定不起作用_Android_Xamarin_Data Binding_Linker_Mvvmcross - Fatal编程技术网

MVVMCROSS Android版本内置复选框&;开关绑定不起作用

MVVMCROSS Android版本内置复选框&;开关绑定不起作用,android,xamarin,data-binding,linker,mvvmcross,Android,Xamarin,Data Binding,Linker,Mvvmcross,我在使用Mvvmcross 5.6.3、目标api 26的Xamarin Android中绑定复选框和开关时遇到问题。这两个小部件都在appcomp活动的片段中使用。它可以链接“仅sdk程序集”,但不能链接“sdk和用户程序集”。 xml中的绑定非常简单: <CheckBox android:id="@+id/checkBox2" android:layout_width="wrap_content" android:layout_height="w

我在使用Mvvmcross 5.6.3、目标api 26的Xamarin Android中绑定复选框和开关时遇到问题。这两个小部件都在appcomp活动的片段中使用。它可以链接“仅sdk程序集”,但不能链接“sdk和用户程序集”。 xml中的绑定非常简单:

  <CheckBox
      android:id="@+id/checkBox2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginEnd="2dp"
      android:clickable="false"
      android:text=""
      local:MvxBind="Checked Selected"
      local:layout_constraintEnd_toStartOf="@+id/mvxCachedImageView_lock"
      local:layout_constraintTop_toTopOf="parent" />

  <android.support.v7.widget.SwitchCompat
        style="@style/EntryHeaderStyle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        local:MvxLang="Text LabelShowStatusMarker"
        local:MvxBind="Checked SettingMasterViewModel.AppSetting.IsShowingStatusMarker" />
虽然这不是必需的,但我已经为AppCompV7复选框和开关小部件复制了上面的代码。没什么帮助。 android日志中没有关于此类问题的消息。不知道还需要什么,但在链接过程中去掉了。请帮忙

谢谢


尼克

你解决了吗?@JoeLv MSFT它解决了。谢谢
    public void Include(CheckBox checkBox)
    {
        checkBox.CheckedChange += (sender, args) => checkBox.Checked = !checkBox.Checked;
        checkBox.Checked = true;
        checkBox.Enabled = true;
        checkBox.Clickable = true;
    }

    public void Include(Switch @switch)
    {
        @switch.CheckedChange += (sender, args) => @switch.Checked = !@switch.Checked;
        @switch.Checked = true;
        @switch.Enabled = true;
        @switch.Clickable = true;
    }
    public void Include(CompoundButton cb)
    {
        cb.CheckedChange += (sender, args) => cb.Checked = !cb.Checked;
    }