WPF数据绑定标签内容

我正在尝试使用数据绑定创建一个简单的WPF应用程序。 代码看起来很好,但是当我更新我的属性时,我的视图没有更新。 这是我的XAML:

   

这是我的代码隐藏:

 namespace Calculator { public partial class MainWindow { public MainWindow() { DataContext = new CalculatorViewModel(); InitializeComponent(); } } } 

这是我的视图模型

 namespace Calculator { public class CalculatorViewModel : INotifyPropertyChanged { private String _calculatorOutput; private String CalculatorOutput { set { _calculatorOutput = value; NotifyPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { var handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } } 

我不明白我在这里失踪了什么? OO

CalculatorOutput没有getter。 View应该如何获得价值? 该物业也必须公开。

 public String CalculatorOutput { get { return _calculatorOutput; } set { _calculatorOutput = value; NotifyPropertyChanged(); } }