MultiBinding MultiBinding MultiBinding MultiBinding Class


描述附加到单个绑定目标属性的 Binding 对象的集合。Describes a collection of Binding objects attached to a single binding target property.

public ref class MultiBinding : System::Windows::Data::BindingBase, System::Windows::Markup::IAddChild
public class MultiBinding : System.Windows.Data.BindingBase, System.Windows.Markup.IAddChild
type MultiBinding = class
    inherit BindingBase
    interface IAddChild
Public Class MultiBinding
Inherits BindingBase
Implements IAddChild


可以在一个MultiBinding对象中指定多个绑定。You can specify multiple bindings in a MultiBinding object. 使用带有转换器的MultiBinding对象时, 它将基于这些绑定的值为绑定目标生成最终值。When you use the MultiBinding object with a converter, it produces a final value for the binding target based on the values of those bindings. 例如, 可以从红色、蓝色和绿色值计算颜色, 这些值可以是来自相同或不同绑定源对象的值。For example, color might be computed from red, blue, and green values, which can be values from the same or different binding source objects. 当值从目标移动到源时, 目标属性值将转换为一组传回绑定的值。When a value moves from the target to the sources, the target property value is translated to a set of values that are fed back into the bindings.

ModeUpdateSourceTrigger属性的值MultiBinding确定的功能, 并将其用作集合中所有绑定的默认值, 除非单个绑定将重写这些属性。The values of the Mode and UpdateSourceTrigger properties determine the functionality of the MultiBinding and are used as the default values for all the bindings in the collection unless an individual binding overrides these properties. 例如, Mode如果将MultiBinding对象的属性设置为TwoWay, 则会考虑TwoWay集合中的所有绑定, 除非你在其中一个绑定上设置Mode了不同的值。For example, if the Mode property on the MultiBinding object is set to TwoWay, then all the bindings in the collection are considered TwoWay unless you set a different Mode value on one of the bindings explicitly. 有关详细信息, 请参阅Binding.ModeBinding.UpdateSourceTrigger属性。For more information, see the Binding.Mode and Binding.UpdateSourceTrigger properties.

MultiBinding 当前仅支持 Binding 类型的对象,而不支持 MultiBindingPriorityBinding 类型的对象。MultiBinding currently supports only objects of type Binding and not MultiBinding or PriorityBinding.


MultiBinding() MultiBinding() MultiBinding() MultiBinding()

初始化 MultiBinding 类的新实例。Initializes a new instance of the MultiBinding class.


BindingGroupName BindingGroupName BindingGroupName BindingGroupName

获取或设置此绑定所属的 BindingGroup 的名称。Gets or sets the name of the BindingGroup to which this binding belongs.

(Inherited from BindingBase)
Bindings Bindings Bindings Bindings

获取此 MultiBinding 实例中的 Binding 对象的集合。Gets the collection of Binding objects within this MultiBinding instance.

Converter Converter Converter Converter

获取或设置用于在源值和目标值之间来回转换的转换器。Gets or sets the converter to use to convert the source values to or from the target value.

ConverterCulture ConverterCulture ConverterCulture ConverterCulture

获取或设置 CultureInfo 对象,该对象应用于任何分配给绑定(由 MultiBinding 包装或是在 MultiBinding 自身上)的转换器。Gets or sets the CultureInfo object that applies to any converter assigned to bindings wrapped by the MultiBinding or on the MultiBinding itself.

ConverterParameter ConverterParameter ConverterParameter ConverterParameter

获取或设置要作为其他信息传递给转换器的可选参数。Gets or sets an optional parameter to pass to a converter as additional information.

Delay Delay Delay Delay

获取或设置更新位于目标更改上的值之后的绑定源前要等待的时间(毫秒)。Gets or sets the amount of time, in milliseconds, to wait before updating the binding source after the value on the target changes.

(Inherited from BindingBase)
FallbackValue FallbackValue FallbackValue FallbackValue

获取或设置当绑定无法返回值时要使用的值。Gets or sets the value to use when the binding is unable to return a value.

(Inherited from BindingBase)
Mode Mode Mode Mode

获取或设置一个值,该值指示此绑定的数据流的方向。Gets or sets a value that indicates the direction of the data flow of this binding.

NotifyOnSourceUpdated NotifyOnSourceUpdated NotifyOnSourceUpdated NotifyOnSourceUpdated

获取或设置一个值,该值指示当值从绑定目标传输到绑定源时是否引发 SourceUpdated 事件。Gets or sets a value that indicates whether to raise the SourceUpdated event when a value is transferred from the binding target to the binding source.

NotifyOnTargetUpdated NotifyOnTargetUpdated NotifyOnTargetUpdated NotifyOnTargetUpdated

获取或设置一个值,该值指示当值从绑定源传输到绑定目标时是否引发 TargetUpdated 事件。Gets or sets a value that indicates whether to raise the TargetUpdated event when a value is transferred from the binding source to the binding target.

NotifyOnValidationError NotifyOnValidationError NotifyOnValidationError NotifyOnValidationError

获取或设置一个值,该值指示是否对绑定元素引发 Error 附加事件。Gets or sets a value that indicates whether to raise the Error attached event on the bound element.

StringFormat StringFormat StringFormat StringFormat

获取或设置一个字符串,该字符串指定如果绑定值显示为字符串,应如何设置该绑定的格式。Gets or sets a string that specifies how to format the binding if it displays the bound value as a string.

(Inherited from BindingBase)
TargetNullValue TargetNullValue TargetNullValue TargetNullValue

获取或设置当源的值为 null 时在目标中使用的值。Gets or sets the value that is used in the target when the value of the source is null.

(Inherited from BindingBase)
UpdateSourceExceptionFilter UpdateSourceExceptionFilter UpdateSourceExceptionFilter UpdateSourceExceptionFilter

获取或设置一个处理程序,可使用该程序提供自定义逻辑,旨在在更新绑定源值期间处理绑定引擎遇到的异常。Gets or sets a handler you can use to provide custom logic for handling exceptions that the binding engine encounters during the update of the binding source value. 这仅适用于你已将 ExceptionValidationRuleMultiBinding 对象相关联的情况。This is only applicable if you have associated the ExceptionValidationRule with your MultiBinding object.

UpdateSourceTrigger UpdateSourceTrigger UpdateSourceTrigger UpdateSourceTrigger

获取或设置一个值,它可确定绑定源更新的计时。Gets or sets a value that determines the timing of binding source updates.

ValidatesOnDataErrors ValidatesOnDataErrors ValidatesOnDataErrors ValidatesOnDataErrors

获取或设置一个值,该值指示是否包含 DataErrorValidationRuleGets or sets a value that indicates whether to include the DataErrorValidationRule.

ValidatesOnExceptions ValidatesOnExceptions ValidatesOnExceptions ValidatesOnExceptions

获取或设置一个值,该值指示是否包含 ExceptionValidationRuleGets or sets a value that indicates whether to include the ExceptionValidationRule.

ValidatesOnNotifyDataErrors ValidatesOnNotifyDataErrors ValidatesOnNotifyDataErrors ValidatesOnNotifyDataErrors

获取或设置一个值,该值指示是否包含 NotifyDataErrorValidationRuleGets or sets a value that indicates whether to include the NotifyDataErrorValidationRule.

ValidationRules ValidationRules ValidationRules ValidationRules

获取此 MultiBinding 实例的 ValidationRule 对象的集合。Gets the collection of ValidationRule objects for this instance of MultiBinding.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ProvideValue(IServiceProvider) ProvideValue(IServiceProvider) ProvideValue(IServiceProvider) ProvideValue(IServiceProvider)

返回一个应在应用了此绑定和扩展的属性上设置的对象。Returns an object that should be set on the property where this binding and extension are applied.

(Inherited from BindingBase)
ShouldSerializeBindings() ShouldSerializeBindings() ShouldSerializeBindings() ShouldSerializeBindings()

指示是否应使 Bindings 属性持久化。Indicates whether the Bindings property should be persisted.

ShouldSerializeFallbackValue() ShouldSerializeFallbackValue() ShouldSerializeFallbackValue() ShouldSerializeFallbackValue()

返回一个值,该值指示序列化进程是否应当对此类的实例的 FallbackValue 有效属性值进行序列化。Returns a value that indicates whether serialization processes should serialize the effective value of the FallbackValue property on instances of this class.

(Inherited from BindingBase)
ShouldSerializeTargetNullValue() ShouldSerializeTargetNullValue() ShouldSerializeTargetNullValue() ShouldSerializeTargetNullValue()

返回一个值,该值指示是否应序列化 TargetNullValue 属性。Returns a value that indicates whether the TargetNullValue property should be serialized.

(Inherited from BindingBase)
ShouldSerializeValidationRules() ShouldSerializeValidationRules() ShouldSerializeValidationRules() ShouldSerializeValidationRules()

指示是否应使 ValidationRules 属性持久化。Indicates whether the ValidationRules property should be persisted.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)


IAddChild.AddChild(Object) IAddChild.AddChild(Object) IAddChild.AddChild(Object) IAddChild.AddChild(Object)

添加子对象。Adds a child object.

IAddChild.AddText(String) IAddChild.AddText(String) IAddChild.AddText(String) IAddChild.AddText(String)

将节点的文本内容添加到对象。Adds the text content of a node to the object.