文本框中的绑定验证规则类错误 [英] error in binding validation rule class in textbox

查看:89
本文介绍了文本框中的绑定验证规则类错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在文本框中绑定验证规则类,但是会引发此错误.

{不能在类型为"Binding"的"Path"属性上设置"Binding".只能在DependencyObject的DependencyProperty上设置"Binding"."}

我的代码是

i am trying to bind a validation rule class in textbox , but it throw this error.

{"A ''Binding'' cannot be set on the ''Path'' property of type ''Binding''. A ''Binding'' can only be set on a DependencyProperty of a DependencyObject."}

my code is

<TextBox x:Name="txtGTIN" Grid.Column="4" Grid.Row="1" Validation.ErrorTemplate="{StaticResource validationErrorTemplate}">
                  <TextBox.Text>
                  <Binding  Path="{Binding MetaData.GTIN}" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
                          <Binding.ValidationRules>
                              <ExceptionValidationRule/>
                          <viewModel:NewECGConfigurationViewModel/>

                          </Binding.ValidationRules>
                      </Binding>
                  </TextBox.Text>
              </TextBox>



它在Path



it throw error in Path

推荐答案

引用中引发错误-
Refer - Binding on a Property which is not a DependencyProperty[^].

It will help you. :)


这篇关于文本框中的绑定验证规则类错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆