我有一组数值的组合框。所选值由具有多个双向绑定的Converter确定。当用户更改ComboBox中的值时,我期望ConvertBack方法被调用并更改多重绑定中使用的两个属性的值,但即使ComboBox失去焦点,这种情况也不会发生。我试图将UpdateSourceTrigger属性更改为“LosesFocus”,但这显然对于MultipleBinding无效。我该如何获取ConvertBack方法来触发,无论是当数值发生变化或控件失去焦点时?要么为我的目的工作。对于WPF转换器MultipleBinding ...什么时候ConvertBack被调用?
XAML:
<ComboBox ItemsSource="{Binding DescriptionList}" DisplayMemberPath="Description" SelectedValuePath="Description" IsEnabled="{Binding EditMode}">
<ComboBox.SelectedValue>
<MultiBinding Converter="{StaticResource DescriptionConverter}">
<Binding Path="PersonRow.DescriptionType" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="PersonRow.DescriptionSuccessful" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" />
</MultiBinding>
</ComboBox.SelectedValue>
</ComboBox>
我尝试添加Mode =“TwoWay”到MutiBinding标记,但ConvertBack方法仍然不会触发。 – jpaull
@jpaull我也从子绑定中删除'Mode'和'UpdateSourceTrigger'属性。你也可以在'MultiBinding'上添加'UpdateSourceTrigger'。 – Jay