Derived State Example
Full Name: (empty)
The full name is automatically updated via callback when first or last name changes.
private string _firstName = string.Empty;
private string _lastName = string.Empty;
private string _fullName = string.Empty;
public string FirstName
{
get => _firstName;
set => SetState(ref _firstName, value, UpdateFullName);
}
public string LastName
{
get => _lastName;
set => SetState(ref _lastName, value, UpdateFullName);
}
private void UpdateFullName()
{
_fullName = $"{_firstName} {_lastName}".Trim();
}