MVVMCROSS Android版本内置复选框&;开关绑定不起作用
我在使用Mvvmcross 5.6.3、目标api 26的Xamarin Android中绑定复选框和开关时遇到问题。这两个小部件都在appcomp活动的片段中使用。它可以链接“仅sdk程序集”,但不能链接“sdk和用户程序集”。 xml中的绑定非常简单: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
<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;
}