Skip to content

Fody Propertychanged on Viewmodels #332

@mos379

Description

@mos379

I'm struggling with using fody propertychanged on viewmodels.

I added the PropertyChangedNotificationInterceptor to the sample project and can see that it doesn't work there eiter.

namespace FreshMvvmApp
{
    internal class PropertyChangedNotificationInterceptor
    {
        public static void Intercept(object target, Action onPropertyChangedAction, string propertyName)
        {
#if DEBUG
            Console.WriteLine(@"[PROPERTYCHANGED] Target: " + target + @" Property: " + propertyName);
#endif
            onPropertyChangedAction();
        }
    }
}

it is working fine on classes like the contacts and prints out the debug info when loading the contacts collection (InitContacts () )
[PROPERTYCHANGED] Target: FreshMvvmApp.Contact Property: Id
[PROPERTYCHANGED] Target: FreshMvvmApp.Contact Property: Name
[PROPERTYCHANGED] Target: FreshMvvmApp.Contact Property: Phone

But what I'm missing is that this should be triggered as well on ViewModels if the actual contact is changed.
Should this be triggered as well when the contact is set on the ContactPageModel?

And yes I know I can use the WhenAny extension but that is working around Fody!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions