- 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.
- 基于Java技術的Web應用開發
- R語言編程指南
- Android 7編程入門經典:使用Android Studio 2(第4版)
- 假如C語言是我發明的:講給孩子聽的大師編程課
- Learning Hunk
- C語言程序設計與應用(第2版)
- FFmpeg開發實戰:從零基礎到短視頻上線
- Web Developer's Reference Guide
- 快樂編程:青少年思維訓練
- 原型設計:打造成功產品的實用方法及實踐
- Getting Started with Windows Server Security
- Mastering Machine Learning with scikit-learn
- Lync Server Cookbook
- Python Business Intelligence Cookbook
- Xamarin Mobile Application Development for Android(Second Edition)