Sly
Sly

Reputation: 15217

MvvmCross RaisePropertyChanged and dot (.) binding

I have a custom binding that accepts entire view model:

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)

And on UI to bind it the MvxBind="BgColor ." Syntax is used. How can I rase PropertyChanged event from my ViewModel for the binding to react? Tried RaiseAllPropertiesChanged with no luck.

Upvotes: 2

Views: 374

Answers (1)

Mando
Mando

Reputation: 11712

Try to add a "Self" property to your ViewModel or View, which returns itself. Then just bind to that Property instead of dot (.) syntax:

public MyViewModel Self
{
    get { return this; }
}

Hope this helps

Upvotes: 3

Related Questions