DataGrid单元验证中的WPF Multibinding转换器

时间:2012-12-20 20:34:00

标签: wpf validation datagrid multibinding

我正在尝试使用Multibinding对datagrid单元格进行验证以启用&根据其他控件值禁用验证&数据

<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获取。

请告诉我代码有什么问题。

0 个答案:

没有答案