Checking new rows in a Silverlight DataGrid

We are using RIA Services / Silverlight 4 and I am binding the datagrid to something like Context.Foo.

I see validation errors appearing in the datagrid data validation summary, when users try to enter blank lines in required fields, etc., life is good.

However, when I add a new element by calling something like Context.Foo.Add (new Foo) in viewModel, a new row appears in the datagrid, but is never checked if the user does not click on the cell.

Is there a way to ask the DataGrid to check all elements?

+3
source share
1 answer

, DataGrid , , . Validator . , , newRowObject, :

List<ValidationResult> validationResults = new List<ValidationResult>();
ValidationContext validationContext = new ValidationContext(newRowObject, null, null);
bool isValid = Validator.TryValidateObject(newRowObject, validationContext, validationResults, true);

, ( , , , ).

, ...

0

Source: https://habr.com/ru/post/1768180/


All Articles