Timeline for Overall view validation with a datagrid and keeping to MVVM
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 29, 2017 at 18:56 | comment | added | Peter M | BTW Putting on my Code Review hat, I think that your AddValidationRule et al is trying to reinvent both DataAnnotations and the INotifyDataErrorInfo interface. About the only good thing in that TechNet article I linked to is that it made me understand DataAnnotations as I had never really encountered it before. (and I only looked INotifyDataErrorInfo for the first time 2 weeks ago!) | |
| Nov 29, 2017 at 18:29 | comment | added | Peter M | I had thought of a Modal dialog as well but in my current application I really want to keep the user as close as possible to the data, and felt that adding another layer would be detrimental to the UI | |
| Nov 29, 2017 at 18:28 | comment | added | Peter M | Collection level validation is my main goal (along with individual property and item validation). I think your solution is headed in the direction of where I want to go if you could inject collection level rules to your AddValidationRule . (Or as I was musing in the other answer, inject all validation rules into the PersonModel) | |
| Nov 29, 2017 at 18:19 | comment | added | Peregrine | Each item must be independent - the validation for an item must only be based on the current state of that item. If you want validation across the whole collection, than that must be handled at the main viewmodel level, e.g. by adding another propertychanged handler to each model item that does the required checking. It seems you're getting overly complicated now though - a better solution might be to make the grid read-only and to have a modal popup window to edit a single item at a time with the required validation. | |
| Nov 29, 2017 at 17:50 | comment | added | Peter M | OK It looks to me like you are simply adding an "IsValid" flag to each Person record, and then pulling out the overall status with PersonGridIsValid . The latter will be read as a part of the ICommand on the button. But how to you validate across multiple people? And do so at the time of editing? EG add a rule that says "FirstName" has to be unique. My initial guess is that you inject the collection itself when you assign the PropertyChanged handlers. | |
| Nov 29, 2017 at 17:23 | history | answered | Peregrine | CC BY-SA 3.0 |