BindingMode 列舉

定義

描述繫結的資料流程方向。Describes the direction of the data flow in a binding.

public enum class BindingMode
public enum BindingMode
type BindingMode = 
Public Enum BindingMode
繼承
BindingMode

欄位

Default 4

使用繫結目標的預設 Mode 值。Uses the default Mode value of the binding target. 每個相依性屬性的預設值都不同。The default value varies for each dependency property. 一般而言,使用者可編輯的控制項屬性 (例如文字方塊和核取方塊的控制項屬性) 預設為雙向繫結,而其他大多數屬性則預設為單向繫結。In general, user-editable control properties, such as those of text boxes and check boxes, default to two-way bindings, whereas most other properties default to one-way bindings. 判斷相依性屬性預設是否會單向或雙向繫結的程式設計方式是,使用 GetMetadata(Type) 取得屬性的屬性中繼資料,然後檢查 BindsTwoWayByDefault 屬性的布林值。A programmatic way to determine whether a dependency property binds one-way or two-way by default is to get the property metadata of the property using GetMetadata(Type) and then check the Boolean value of the BindsTwoWayByDefault property.

OneTime 2

當應用程式啟動或資料內容變更時,更新繫結目標。Updates the binding target when the application starts or when the data context changes. 如果您使用的資料適合使用目前狀態的快照集或資料是真正的靜態,則此類型的繫結很適當。This type of binding is appropriate if you are using data where either a snapshot of the current state is appropriate to use or the data is truly static. 如果您想要以來源屬性的某些值初始化目標屬性,但無法預先得知資料內容,則此類型的繫結也很有用。This type of binding is also useful if you want to initialize your target property with some value from a source property and the data context is not known in advance. 基本上這是 OneWay 繫結的簡單形式,而這在來源值沒有變更的情況下可以提供更好的效能。This is essentially a simpler form of OneWay binding that provides better performance in cases where the source value does not change.

OneWay 1

當繫結來源 (來源) 變更時,更新繫結目標 (目標) 屬性。Updates the binding target (target) property when the binding source (source) changes. 如果要繫結的控制項是隱含唯讀的,這種類型的繫結很適當。This type of binding is appropriate if the control being bound is implicitly read-only. 例如,您可以繫結至來源,例如股票行情指示器。For instance, you may bind to a source such as a stock ticker. 或者目標屬性沒有可供進行變更的控制項介面,例如資料表的資料繫結背景色彩。Or perhaps your target property has no control interface provided for making changes, such as a data-bound background color of a table. 如果沒有需要監視目標屬性的變更,則使用 OneWay 繫結模式可以避免 TwoWay 繫結模式所帶來的負荷。If there is no need to monitor the changes of the target property, using the OneWay binding mode avoids the overhead of the TwoWay binding mode.

OneWayToSource 3

當目標屬性變更時,更新來源屬性。Updates the source property when the target property changes.

TwoWay 0

造成來源屬性或目標屬性變更為自動更新對方。Causes changes to either the source property or the target property to automatically update the other. 這種類型的繫結適合可編輯表單或其他完全互動式的 UIUI 案例。This type of binding is appropriate for editable forms or other fully-interactive UIUI scenarios.

適用於

另請參閱