命名空间前缀“utilities"没有定义 [英] the namespace prefix "utilities" is not defined
本文介绍了命名空间前缀“utilities"没有定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对 WPF 还很陌生...我试图将验证绑定到 WPF 中的文本框.
I am fairly new to WPFs... I was trying to bind a validation to a text box in WPF.
这是我在 xaml 中的文本框:
Here is my text box in the 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>
这是我的验证类:
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:
错误未定义命名空间前缀utilities".
Error The namespace prefix "utilities" is not defined.
有人知道为什么吗?
推荐答案
它没有定义,因为你没有定义它.看看你的 XAML 文件的顶部,所有的东西,比如 xmlns:foobar="clr-namespace:Foo.Bar"
.你需要在那里定义它.
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"
. You need to define it there.
这篇关于命名空间前缀“utilities"没有定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文