Hi, I have an application where users are editing rows. Using MVVM Pattern and wondering if I can hook a command whenever a cell is edited.
Is it possible? Thanks a lot.
Hi, I have an application where users are editing rows. Using MVVM Pattern and wondering if I can hook a command whenever a cell is edited.
Is it possible? Thanks a lot.
If I'm guessing correctly you have a ViewModel for the row, so you could just put some code into the setter for the cell value. What do you want to do with the command?
UPDATE: If you want to track which rows have changed just add an IsModified flag to your row ViewModel and set the flag in every property setter that's editable through your grid. No need for a command.
UPDATE: I've put together a small example to show what I meant.
public class RowViewModel
{
private bool _IsModified = false;
private string _FirstName;
public string FirstName
{
get { return _FirstName; }
set { _FirstName = value; _IsModified = true; }
}
private string _LastName;
public string LastName
{
get { return _LastName; }
set { _LastName = value; _IsModified = true; }
}
}