Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force a TextChanged event on a WPF TextBox and mantain the focus?

I am creating a numeric TextBox in WPF, with two buttons to increase and decrease the value.

I have create two RoutedCommand to manage the behiavor and they are working well. There is only one problem that I would like to solve. I would like that the control notifies all object binded to its TextProperty when an increase or decrease command is executed.

At the moment it sends the notification only when I change the focus to another control

Any help is really appreciated, Thank you

like image 727
Drake Avatar asked Mar 30 '10 14:03

Drake


1 Answers

There is a simple way:

Text="{Binding Path=MyProperty, UpdateSourceTrigger=PropertyChanged}"

(I tested it on TextBox). Good Luck

like image 180
Shaipod Avatar answered Oct 04 '22 16:10

Shaipod