-
Notifications
You must be signed in to change notification settings - Fork 1
Task02
SeRgI1982 edited this page Aug 30, 2017
·
1 revision
WPF have two interfaces supporting validation:
- IDataErrorInfo,
- INotifyDataErrorInfo.
The second one (INotifyDataErrorInfo) is a newer one and have much more features than former solution:
- multiple rules per property,
- cross-property validation,
- async validation.
Create ValidationObject class which will be implemented INotifyDataErrorInfo interface.
Using DataAnnotations attributes create basic validations for the fields:
- ProjectId - filed is required
- WorkTitle - character length between 2 and 50.
Create Custom Validators:
- TimeSpent - time spent for specific Task (Work Title) can't be longer than 8 hours,
- DateStarted - time spent on Sunday can't be longer than 2 hours.
Validate data before Add/Update timesheet entry (operation can be done only if data are valid).
Create custom ErrorTemplate - the red circle should be visible when validation fails and should be placed on the right side - next to the control (hint: adorner).
ToolTip should present error message.