I have a very simple compound property where I join 2 strings together to make a readonly third property so I can bind just 1 property to xaml.
public string LocationCompleteString => $"{LocationName}/{SubLocationName}";
Which works as expected, but issue is I also want to RaiseNotification for LocationCompleteString whenever "LocationName" or "SubLocationName" updates, for that I tried following:
public MyClass() => PropertyChanged += MyClass_PropertyChanged;
private void MyClass_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if(e.PropertyName == nameof(LocationName) || e.PropertyName == nameof(SubLocationName))
{
RaisePropertyChanged(LocationCompleteString);
}
}
But this doesnt work because this doesnt update the value of LocationCompleteString so before raising notification I first need to somehow update its value, I am aware that I can make a private method which returns value for this property and then just before Raising notification for it I can update its value again with that method, but I was wondering if there was a better and more generic way to achieve it? maybe somehow I can call the "LocationCompleteString.Get()" method which will execute its get method again to update the value or something like that?
Sample project : https://github.com/touseefbsb/CompoundNotify
Thanks.