我希望有人能帮助我解决这个问题,我怀疑我正在做一些愚蠢的事情。我绑定了一个TextBox
,以便Text
绑定到InputValue
。基本上,当文本值改变时,我有一个方法(Inches.Parse
),它检查值并返回格式良好的字符串。在set访问器中更改文本框绑定的文本值
如果解析没有错误,我希望文本框具有名为“result”的格式良好的字符串。但是,TextBox
不会显示新文本?任何帮助,将不胜感激。
public string InputValue
{
get
{
return _inputValue;
}
set
{
if (_inputValue != value)
{
bool error;
string result = Inches.Parse(value, 64, out error);
if (error != IsValid)
{
IsValid = error;
}
if (!error)
{
_inputValue = result;
}
else
{
_inputValue = value;
}
NotifyPropertyChanged("InputValue");
}
}
}
谢谢Aran,明天我会试试看看会发生什么。 – 2010-02-07 05:20:30
不用担心和生病明天在代码工作,以确保我得到它正确 – 2010-02-07 05:44:22
检查出来,写了一个测试项目,上面的语法工程 – 2010-02-07 22:36:00