Hi Shailesh,
The information you provided is not sufficient to help you without any doubts.
However, we can work on the basics of the setup you describe, and try to suggest an approach.
The "natural" approach to handle what you are refering to is indeed through the use of DelegateCommand or another similar class. The trick is that the button in the Cell need to have access to the DataContext for your View (typically the ViewModel), so he can bind his Command property to the DelegateCommand.
Because the DataGrid for WPF is a complex control in itself, the DataContext from the Cell is NOT the DataContext from the DataGridControl. A quick way to compensate for this is to rebind the DataContext of the button to that of the DataGridControl.
Note: This assumes that the ViewModel is the DataContext of the DataGridControl.
<Button DataContext="{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.ParentDataGridControl).DataContext}"
Command="{Binding MyCommandFromViewModel}" />
Alternatly, you could also use a "FindAncestor" binding, but I prefer the first approach, since the FindAncestor binding resolves "later" than other types of binding.
<Button DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type xcdg:DataGridControl}}, Path=DataContext}"
Command="{Binding MyCommandFromViewModel}" />
Note2: Code provided is only provided as example, I have not compiled code above.
Marc Laroche
Software Developer
Xceed Software Inc.I don’t suffer from insanity, I enjoy every minute of it. - Unknown