Can you suggest similr event for TextChange event of a TextBox in .Net WPF
I have to do complex calculations on every textchange 开发者_如何学编程event of a WPF textbox , Is there any similar event ?
you can make use of Binding for that and make sure sure any change to the bound item gets triggered:
<TextBox Text="{Binding Path=X, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
and then in your viewModel you can do calculations based on that change (your ViewModel should implement INotifyPropertyChanged
:
public int MyProperty
{
get
{
return myVar ;
}
set
{
myVar = value;
OnPropertyChanged("MyProperty") ;
//Fire off calculation in another thread in here
}
}
精彩评论