In a wpf view, i have 3 textboxes which implement a custom validation rules like this :
<TextBox HorizontalAlignment="Left"
Height="30"
Grid.Row="2"
Grid.Column="1"
TextWrapping="Wrap"
VerticalAlignment="Top"
Width="150"
Validation.ErrorTemplate="{StaticResource ValidationTemplate}">
<TextBox.Text>
<Binding Path="Model.Age"
Mode="TwoWay"
UpdateSourceTrigger="PropertyChanged"
ValidatesOnExceptions="True"
ValidatesOnDataErrors="True">
<Binding.ValidationRules>
<validation:DataTypeValidationRules DataTypeRule="Required"
ErrorMessage="Required field" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
My problem is : If i change the text directly in textbox, the validation work and i can see my template if the textbox has no value, but if i do nothing in the view and click on my save button, which has a command binding to my ViewModel, the validation is not working, because i think there is no OnPropertyChange event who was raised, so i need to check again if the value is not empty in my viewmodel, and i don't want to do this like that.
Note : I'm using the MVVM pattern
Sorry for my English and many thanks for your responses.