value不会在整数属性中更新 [英] value is not updated in integer property

查看:100
本文介绍了value不会在整数属性中更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在从文本框中删除数据后更新我在整数属性中的值,

就像我有一个文本框,在这个文本框中我在这个文本框中输入123如果我删除了这个123(数据)文本然后数据没有在整数属性更新,它需要以前的值(123),所以请帮助我如何解决这个问题,目前我正在使用wpf mvvm模式

how i update my value in integer property after deletion of data from textbox,
like i have a textbox and in this textBox i enter 123 in this textbox if i delete this 123(data) from text then the data is not updated in the integer property ,it takes previous value (123),so please help me how i solve this problem,Currently i am working in wpf mvvm pattern

推荐答案

正如我所说,你使用MVVM。如果是这样,你只需修改.xaml文件中的绑定。

这看起来像:



< TextBox名称=tb1

Text ={Binding Numbertest,Mode = TwoWay,UpdateSourceTrigger = PropertyChanged}/>



TwoWay绑定意味着您可以设置属性值并在GUI中查看它。

只要绑定属性的值发生更改,PropertyChanged就会指定TextBox自行刷新。



我希望这适合你。
As I have remarked you use MVVM. If so, than you only need to modify your binding in the .xaml file.
This would look like:

<TextBox Name="tb1"
Text="{Binding Numbertest, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

TwoWay binding means you can set the property value and see it in the GUI back.
PropertyChanged specifies to the TextBox to refresh itself, whenever the value of the bound property changes.

I hope this works for you.


这篇关于value不会在整数属性中更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆