Open
Description
Overview
Hi, I'm migrating some old C# ViewModel code to use the [ObservableProperty] attribute on all the properties.
I'd like to convert the following code:
private string _windowTitle;
public string WindowTitle {
get {
return _windowTitle;
}
set {
_windowTitle = $ "Window title prefix: {value}";
OnPropertyChanged(nameof(WindowTitle));
}
}
...but I couldn't find any "simple" or "standard" method to accomplish the same behavior using the MVVM Toolkit.
I discovered that recently the methods *Changing(string? newValue) or *Changing(string? oldValue, string newValue) got added, but the newValue isn't passed as ref string
, so I can't intercept and change the value.
Could this prototype be implemented for those methods? Thanks!
API breakdown
partial void OnWindowTitleChanging(ref string value);
partial void OnWindowTitleChanging(string? oldValue, ref string newValue);
Usage example
partial void OnWindowTitleChanging(string? oldValue, ref string newValue)
{
newValue = "Window title prefix: " + newValue;
}
Breaking change?
I'm not sure
Alternatives
Additional context
No response
Help us help you
No, just wanted to propose this