Skip to content

(Fix Included) Does not update all bindings in VM when passing Null or String.Empty #39

@BlackHatCS

Description

@BlackHatCS

The original INotifyPropertyChanged allows a user to pass a PropertyChangedEventArgs of null or String.Empty as a shorthand for updating all registered bindings on the current ViewModel.

After looking over your code I found re-enabling this was VERY simple.

Inside PropertyWatcher.cs at the bottom you have:

private void propertyOwner_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == propertyName) { action(); } }

By simply adding "|| String.IsNullOrEmpty(e.PropertyName)" to the if statement the expected behavior can be achieved. Since the PropertyWatcher class is already designed to be limited to the scope of the current view model, no further code is needed.

private void propertyOwner_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == propertyName || String.IsNullOrEmpty(e.PropertyName)) { action(); } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions