我有一个接受整个 View 模型的自定义绑定(bind):
public class TextViewGroupInfoBinding : BaseBinding<TextView, GroupViewModel>
{
private IMvxAndroidCurrentTopActivity CurrentTopActivity
{
get { return ServiceLocator.Current.GetInstance<IMvxAndroidCurrentTopActivity>(); }
}
public TextViewGroupInfoBinding(TextView androidControl) : base(androidControl)
{
}
public override MvxBindingMode DefaultMode
{
get { return MvxBindingMode.OneWay; }
}
protected override void SetValueToView(TextView control, GroupViewModel value)
在 UI 上使用 MvxBind="BgColor ."
语法进行绑定(bind)。如何从我的 ViewModel
中引发 PropertyChanged
事件以使绑定(bind)使用react?尝试了 RaiseAllPropertiesChanged
但没有成功。
最佳答案
尝试向 ViewModel 或 View 添加“Self”属性,该属性会返回自身。然后只需绑定(bind)到该属性而不是点 (.) 语法:
public MyViewModel Self
{
get { return this; }
}
希望这有帮助
关于c# - MvvmCross RaisePropertyChanged 和点 (.) 绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30913499/