本文介绍了TextBox更改事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 我正在构建一个wpf窗口应用程序,在这里我设计一个动态Datagrid并在该网格中我提供了一个文本框,当用户输入文本时,应该进行一些计算在网格...但我的问题是,当用户试图在文本框中输入100并输入1表示事件正在触发....所以对于3位数,它将触发3次...所以请在将完整的数据输入文本框后帮助我调用一次事件....我对模糊事件的处理也没有问题...请帮我提供代码...这是我的处理程序写的.. 。 DataTemplate textBoxTemplate = new DataTemplate(); FrameworkElementFactory textboxElement = new FrameworkElementFactory(typeof(TextBox)); 绑定textboxBinding = new绑定(LineItemUnits); 绑定txtLineItemID = new绑定(LineItemID); textboxE lement.AddHandler(TextBox.TextChangedEvent,new TextChangedEventHandler(txtUnitCount_Changed)); textboxElement.SetBinding(TextBox.TagProperty,txtLineItemID); textBoxTemplate.VisualTree = textboxElement; templateColumn.CellTemplate = textBoxTemplate; grdCharges.Columns.Add(templateColumn); textboxElement.AddHandler(TextBox .TextChangedEvent, newTextChangedEventHandler(txtUnitCount_Changed));Hello, I am builing a wpf window application, Here i am desiging a dynamic Datagrid and in that grid i am providing a text box, when the user enters the text some calculations should be done in the grid... But my problem is that whenn the user tries to enter "100" in the text box and enter "1" means the event is firing.... so for 3 digits it is firing 3 times... so please help me to call the event only once after entering complete data into text box .... I have no problem in handling on blur events also... Please help me with providing code... here is my handler written... DataTemplate textBoxTemplate = new DataTemplate(); FrameworkElementFactory textboxElement = new FrameworkElementFactory(typeof(TextBox)); Binding textboxBinding = new Binding("LineItemUnits"); Binding txtLineItemID = new Binding("LineItemID"); textboxElement.AddHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(txtUnitCount_Changed)); textboxElement.SetBinding(TextBox.TagProperty, txtLineItemID); textBoxTemplate.VisualTree = textboxElement; templateColumn.CellTemplate = textBoxTemplate; grdCharges.Columns.Add(templateColumn);textboxElement.AddHandler(TextBox.TextChangedEvent, newTextChangedEventHandler(txtUnitCount_Changed));private void txtUnitCount_Changed(object Sender, TextChangedEventArgs e) { }推荐答案 这篇关于TextBox更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-30 08:14