Hello Sushma,
I modified your sample to add an implemention for the Command in the Person object. When the command is executed, I disable the button. I also updated the sample to add columns to the grid and bind the grid to a view model which includes a collection of people. When I press the button for some rows those buttons become disabled. I am then able to select other rows without the button’s states changing.
Please see my sample and let me know if this helps resolve you issue or you are still seeing a problem. My modified sample was tested on build 13.2.20132.2300 in NetAdvantage for WPF 2013 Volume 2.
Let me know if you have any questions.
Sincerely,
Valerie
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
This seems to work. So now I have a DelegateCommand in each instance of the Person class. But I create my Person objects in my Model so the CanCommandExecute and CommandExecute would go into the model. I am not comfortable with it. I would rather have it into the ViewModel class.
What I really want is a single command in my view model and bind my XamDataGrid's last column to this command. The command must execute on the row in which it lies.
I tried the same by creating an Observable collection the same as you did, but instead of putting the command in the Person class, I put it in the view model. I bound the button in the view with this command passing in the corresponding row as parameter. But I am facing a strange issue here where whenever my underlying observable collection is cleared and reloaded, my XamDataGrid doesn't get loaded. So the button's which are bound there, their CanExecute deosn't get fired. And so sometimes the first button looks disabled and sometimes third in any random order. Of course when I click on it, if it is supposed to be disabled, the CanExecute runs and returns false. However, the button still remains enabled.
I hope you got my problem. So what I really want is a single command in my ViewModel bound to the view's last column's buttons and getting in the row as parameter whenever I click on the command.