1
3
你想把
现在,您的文本框将反映您已分配(或绑定)到“someControl.TheText”属性的值-您不需要更改任何其他代码,尽管您可能希望在基础myClass对象上实现inotifyPropertyChanged,以便绑定知道属性何时更改。 |
2
1
马特为你的问题提供了解决方案。这里有更多的解释和提示,以阻止这个问题在未来。
AS
任何在运行时失败的绑定都会导致调试消息被记录到Visual Studio的输出面板中。在这种情况下,您可能会看到“somecontrol”类型的对象上不存在这样的属性“myStringProp”,这应该会引起您的怀疑。 我认为每个人都会发现WPF数据绑定需要一些时间来学习,特别是调试,但是要坚持下去。WPF中的数据绑定真的非常棒,我仍然很高兴知道它使我的UI上的数据保持最新。 |
Pablo De Luca · 保存表单控件值以供以后使用 6 年前 |
Foitn · Winforms禁用数据预览 6 年前 |
Sach · 将WPF ScrollViewer内容导出为单独的PNG 6 年前 |