I have a TextBox whose Value is binded to a ViewModel property:
<TextBox Name="txtRunAfter" Grid.Column="4" Text="{Binding Mode=TwoWay, Path=RunAfter}" Style="{StaticResource TestStepTextBox}"/>
The set and get were working fine until I tried to add some validation when the Value is set:
private int _runAfter = 0;
public string RunAfter
{
get
{
return _runAfter.ToString();
}
set
{
int val = int.Parse(value);
if (_runAfter != val)
{
if (val < _order)
_runAfter = val;
else
{
_runAfter = 0;
OnPropertyChanged("RunAfter");
}
}
}
}
Although the OnPropertyChanged is reached (I have dubugged that), the View is not changed. How can I make this work?
Thanks, José Tavares