且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Xamarin Forms 将属性绑定到标签的文本

更新时间:2022-06-19 03:05:03

需要声明可以获取"变量.

You need to declare that you can "get" the variable.

public string myProperty { get; } = "MY TEXT";

如果你真的想在代码中改变这个变量,你的类需要实现 INotifyPropertyChanged,否则它总是MY TEXT"

If you actually want to change this variable in code, your class will need to implement INotifyPropertyChanged, otherwise it will always be "MY TEXT"