FrameworkContentElement.BindingGroup 屬性


取得或設定用於項目的 BindingGroupGets or sets the BindingGroup that is used for the element.

 property System::Windows::Data::BindingGroup ^ BindingGroup { System::Windows::Data::BindingGroup ^ get(); void set(System::Windows::Data::BindingGroup ^ value); };
public System.Windows.Data.BindingGroup BindingGroup { get; set; }
member this.BindingGroup : System.Windows.Data.BindingGroup with get, set
Public Property BindingGroup As BindingGroup


用於項目的 BindingGroupThe BindingGroup that is used for the element.



BindingGroup 可以用來驗證物件的多個屬性值。A BindingGroup can be used to validate the values of multiple properties of an object. 例如,假設應用程式提示使用者輸入位址,然後將具有屬性 StreetCityZipCodeCountry的物件填入 Address,其中包含使用者提供的值。For example, suppose that an application prompts the user to enter an address and then populates an object of type Address, which has the properties Street, City, ZipCode, and Country, with the values that the user provided. 應用程式有一個面板,其中包含四個 TextBox 控制項,每個控制項都系結至物件的其中一個屬性。The application has a panel that contains four TextBox controls, each of which is bound to one of the object's properties. 您可以使用 BindingGroup 中的 ValidationRule 來驗證 Address 物件。You can use a ValidationRule in a BindingGroup to validate the Address object. 例如,ValidationRule 可以確保郵遞區號對位址的國家/地區有效。For example, the ValidationRule can ensure that the zip code is valid for the country/region of the address.

子專案會繼承其父元素的 BindingGroup,就像任何其他可繼承的屬性一樣。Child elements inherit the BindingGroup from their parent elements, just as with any other inheritable property.

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field BindingGroupProperty
設定為 true 的中繼資料屬性Metadata properties set to true Inherits