- Mastering Windows Presentation Foundation
- Sheridan Yuen
- 229字
- 2021-06-24 16:49:07
Data binding basics
In WPF, we use the Binding class to create our bindings. In general, it is fair to say that every binding will contain four constituent parts. Let's take a look at them now:
- The first is the binding source; typically, this will be one of our View Models.
- The second is the path to the property from the source object that we would like to data bind to.
- The third is the binding target; this will typically be a UI control.
- The fourth is the path to the property of the binding target that we want to data bind to.
If one of our bindings does not work, it is most likely that one of these four things has not been set correctly. It is important to stress that the target property will typically be from a UI control, because there is a data binding rule that states that the binding target must be a Dependency Property. The properties of most UI controls are Dependency Properties, and so, this rule simply enforces that data normally travels in the direction from our View Model data sources to the binding target UI controls.
We'll examine the direction of data bound data traversal later in the chapter, but let's first focus on the syntax that is used to specify the value of the Binding.Path property.
- Functional Python Programming
- 少年輕松趣編程:用Scratch創作自己的小游戲
- 數據結構(C語言)
- Android Native Development Kit Cookbook
- Keras深度學習實戰
- Node.js:來一打 C++ 擴展
- Webpack實戰:入門、進階與調優
- Arduino可穿戴設備開發
- 從程序員角度學習數據庫技術(藍橋杯軟件大賽培訓教材-Java方向)
- Learning iOS Security
- Learning Python Data Visualization
- Mastering JavaScript
- MySQL數據庫應用實戰教程(慕課版)
- Android初級應用開發
- Java EE輕量級解決方案:S2SH