'How to trigger all Data errors on WPF MVVM form
I am trying to show 'Required' in red text when the form is loaded and the text is empty what is the best way to display all required field once the form is visible?
I have about 7 more textboxes.
XAML:
<TextBox x:Name="SubTotalApples" Text="{Binding SubTotalApplesValue, StringFormat={}{0:0.00##}, ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus}"/>
<TextBox x:Name="SubTotalOranges" Text="{Binding SubTotalOrangesValue, StringFormat={}{0:0.00##}, ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus}/>
ViewModels properties
[Required(ErrorMessage = "Required")]
public bool? SubTotalApplesValue
[Required(ErrorMessage = "Required")]
public bool? SubTotalOrangesValue
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
