Iam using XamDatagrid in WPF using MVVM/C#. I have an editable column in the grid with EditModeStart/End commands. These commands have 'get' methods where the code does something just before the starting and ending of a grid cell. Now I want to validate the cell value to make sure its between -100 and 100 with an alert box else I shoudnt permit the user to do anything on the WPF view.
Can someone please help me out? FYI, All my code is in viewmodel only.
Many thanks in advance,
Ravi
The simplest way to do it in MVVM way is have an attached property hooked up to the CellUpdated routed event in the class on a VM side that will execute an ICommand (like RoutedCommand) on the ViewModel class when the cell's updated and cell exits edit mode. Then, you do your processing/validation within the RoutedCommand method and depending on how you hooked up your Msgbox handle the validation results. See Brian Laguna's blog for details: http://brianlagunas.com/an-mvvm-friendly-property-for-the-xamdatapresenter-doubleclick-event/