开发者

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

            }
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜