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. 例如,假设应用程序提示用户输入地址,然后使用用户提供的值填充类型为的对象 Address ,该对象具有属性 StreetCityZipCodeCountryFor 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. 可以 ValidationRule 在中使用 BindingGroup 来验证 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
元数据属性设置为 trueMetadata properties set to true Inherits