Property of object doesn't update the binding

I have an object, in which i change a property that i want to display in a textblock through a binding.

I.e.

<TextBlock TextWrapping="Wrap" Text="{Binding ObjectName.Property}"/>

viewmodel:

public void MethodToChangeObjectProperty()
{
    //Some random code
    ObjectName.Property = SomeValuetoAdd;
}

public Object ObjectName
{
    get {return _objectName; }
    set 
    {
        _objectName = value;
        NotifyPropertChanged();
    }
}

The property is being updated. but the setter is never getting triggered, which means that the value is never reaching my view. I'm sure that the NotifyPropertyChanged(); is not my problem.

1 answer

  • answered 2019-11-08 13:47 Alex Butenko

    Your binding is to ObjectName.Property, that means the property where you need to put NotifyPropertChanged() is Property. ObjectName property is not relevant for this case. So, ObjectName class should implement INotifyPropertyChanged interface and Property should have NotifyPropertChanged() in its own setter.