1

我正在尝试使用 Multibinding 对数据网格单元格进行验证,以启用和禁用基于其他控件值和数据的验证。

<TextBox Validation.ErrorTemplate="{StaticResource errorTemplateSilverlightStyle}" Grid.Column="5" Grid.Row="10" Name="totalNumberOfPackagesInMBLTextBox" MinWidth="150" MaxWidth="150" Margin="5" HorizontalAlignment="Left" >
<TextBox.Text>
    <Binding  Path="TotalNumberOfPackagesInMBL" Mode="TwoWay" ValidatesOnDataErrors="True"  NotifyOnValidationError="true"  UpdateSourceTrigger="PropertyChanged" >
        <Binding.ValidationRules>
            <validate:RequiredFieldRule>
                <validate:RequiredFieldRule.IsEnabled>
                    <validate:ValidationRuleProperty>
                        <validate:ValidationRuleProperty.IsEnabled>
                            <MultiBinding Converter="{StaticResource sealFieldRequiredConverter}" ConverterParameter="S">
                                <Binding Path="Text" ElementName="sealTypeTextBox" Mode="OneWay"/>
                                <Binding Path="Items.Count" ElementName="shippingBillEOUsDataGrid" Mode="OneWay"/>
                            </MultiBinding>
                        </validate:ValidationRuleProperty.IsEnabled>
                    </validate:ValidationRuleProperty>
                </validate:RequiredFieldRule.IsEnabled>
            </validate:RequiredFieldRule>
            <validate:IsNumberValidationRule/>
        </Binding.ValidationRules>
    </Binding>
</TextBox.Text>

因此,使用此代码,我无法将转换器中的控制值作为 UnSetvalue 获得。

请让我知道代码有什么问题。

4

0 回答 0