# 数据绑定

数据绑定提供了一种简单的方法将数据载入应用的 UI，无需在数据的值变化时为每个控件的属性赋值。

数据绑定是一种将数据的属性与控件的属性建立映射的方式。映射可以是双向的，控件的变化可以应用在底层对象，底层对象的变化反过来也可以导致 UI 的变化。映射也可以是单向的，更改只会向一个方向传播。例如当用户编辑 `TextBox` 中的值时，其底层对象的属性会自动更新为用户输入的值。

绑定通常用于 [MVVM模式](https://msdn.microsoft.com/en-us/library/hh848246.aspx)，接下来的教程我们将假设你的代码正在使用这种模式。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://avaloniachina.gitbook.io/avalonia/docs/data-binding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
