using CommunityToolkit.Mvvm.ComponentModel; namespace AciTester.Models { public partial class StageData : ObservableObject { [ObservableProperty] private string stageName; [ObservableProperty] private double cutoffDiameter; private double _initialWeight; public double InitialWeight { get => _initialWeight; set { if (SetProperty(ref _initialWeight, value)) OnPropertyChanged(nameof(NetWeight)); // 关键:通知净重变化 } } private double _finalWeight; public double FinalWeight { get => _finalWeight; set { if (SetProperty(ref _finalWeight, value)) OnPropertyChanged(nameof(NetWeight)); // 关键:通知净重变化 } } // 计算属性,不存储 public double NetWeight => FinalWeight - InitialWeight; } }