简体   繁体   English

未定义名称空间前缀“实用程序”

[英]the namespace prefix “utilities” is not defined

I am fairly new to WPFs... I was trying to bind a validation to a text box in WPF. 我对WPF相当陌生...我试图将验证绑定到WPF中的文本框。

Here is my text box in the xaml: 这是我在xaml中的文本框:

<TextBox>
  <TextBox.Text>
    <Binding Source="{x:Static r:Settings.Default}" Path="ServerIP" UpdateSourceTrigger="PropertyChanged">
      <Binding.ValidationRules>
        <utilities:PingValidationRule />
      </Binding.ValidationRules>
    </Binding>
  </TextBox.Text>
</TextBox>

Here is my validation class: 这是我的验证类:

    public class PingValidationRule : ValidationRule
    { 
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            ...
            if (ipCorrect) return new ValidationResult(true, null);
            else return new ValidationResult(false, "It's not an IP");
        }
    }

With this I have the following error: 有了这个我有以下错误:

Error The namespace prefix "utilities" is not defined. 错误未定义名称空间前缀“实用程序”。

Anyone knows why? 有人知道为什么吗?

It is not defined because you did not define it. 未定义,因为您没有定义它。 Look at the top of your XAML file, all the stuff like xmlns:foobar="clr-namespace:Foo.Bar" . 查看XAML文件的顶部,所有类似xmlns:foobar="clr-namespace:Foo.Bar" You need to define it there. 您需要在那里定义它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 XmlDsigXPathTransform - 未定义名称空间前缀 - XmlDsigXPathTransform - namespace prefix is not defined 未定义名称空间前缀“system” - The namespace prefix “system” is not defined 未定义命名空间前缀“ m2” - Namespace prefix 'm2' is not defined 如果命名空间也被定义为默认值,则强制XDocument不使用命名空间前缀 - Force XDocument to not use namespace prefix if namespace is also defined as default 查询XmlDocument而不会得到“未定义名称空间前缀”问题 - Query an XmlDocument without getting a 'Namespace prefix is not defined' problem 找不到类型或命名空间“实用程序” - Type or NameSpace "Utilities" could not be found 需要命名空间管理器或XsltContext。 此查询具有前缀,变量或用户定义的函数。 在HTMLAgilityPack中 - Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function. in HTMLAgilityPack 需要命名空间管理器或 XsltContext。 此查询具有前缀、变量或用户定义的函数 - Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function 需要HtmlAgilityPack命名空间管理器或XsltContext。 该查询具有前缀,变量或用户定义的函数 - HtmlAgilityPack Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function 连接到NetSuite Web服务时出现SOAP错误:“名称空间前缀'soapenv'未定义” - SOAP error when connecting to NetSuite web services: “Namespace prefix ' soapenv' not defined”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM