Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mvvm wpf: update value binding before leaving focus of input element

I have this element in my xaml (DevExpress item):

<dxe:ComboBoxEdit IsTextEditable="False" EditValue="{Binding IDTIPOCONN}" 
     ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window},Path=DataContext.ttc}"  />

All the binding are correct, and when I change the value, I trigger some event from my ViewModel.

My problem is the update of the value is executed only when I leave the focus of my comboBox. I need, instead, to execute my action when the value is changed, before leaving its foucs.

How can I do it? I need this because selecting one or another from the list, I show to the user some hidden elements.

like image 483
Piero Alberto Avatar asked Feb 02 '26 04:02

Piero Alberto


1 Answers

Try for Binding set UpdateSourceTrigger=PropertyChanged:

<dxe:ComboBoxEdit IsTextEditable="False"
                  EditValue="{Binding Path=IDTIPOCONN, UpdateSourceTrigger=PropertyChanged}" ... />

In this case, most likely the default value of UpdateSourceTrigger is LostFocus.

like image 106
Anatoliy Nikolaev Avatar answered Feb 04 '26 17:02

Anatoliy Nikolaev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!