Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Textbox binding - how to do validation on PropertyChanged but only UpdateSource on LostFocus?

$
0
0

I have a textbox that is setup for binding like below

<TextBox FontWeight="Normal"><TextBox.Text><Binding Path="Students" Mode="TwoWay" NotifyOnValidationError="True" ValidatesOnExceptions="True" UpdateSourceTrigger="PropertyChanged" Converter="{StaticResource StudentConverter}"><Binding.ValidationRules><StaticResource ResourceKey="StudentsCountValidator" /></Binding.ValidationRules></Binding></TextBox.Text></TextBox>

It seems to me that the trigger for the validation is dependent on whichever set for UpdateSourceTrigger. Is there a way to make it independent from UpdateSourceTrigger without using code behind?

What I want is to do validation whenever the text is changed, but I only want to update source when the textbox is lost focus. Seems mission impossible for me now without code behind or nasty custom textbox control.

Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>