I am working on a WPF project, and right now I am validating data in a DataGrid. so, when invalid data is inserted I show a notification image in the RowHeader. Everything goes well so far.
But my question is: Is there a way to block any other control in the apllication when “Invalid” data is inserted excepting the current row of the DataGrid?? Or, what can I do to prevent the current row from lose the focus until correct data is entered??
So far my idea is to Raise an event using eventAggregator to inform all the controls about the error. But this is hard since I would have to suscribe a method in each control I could have.
Hope someone can help me, thank you in advance.
by canceling the CellEditEnding Event you stop the cell from losing focus:
EDIT:
EventAggregator is a good way to solve it, but since you know that but seem to not like it, a simpler way would be following, though you would have to specify a few types of controls that should be able to be stopped:
thanks to Bryce Kahle for the FindVisualChildren from here