Binding Command has no effect in CellTemplate

Sep 15, 2009 at 8:16 AM

If I binding a command to a button and define  command in resource ,like  following code :

<Button x:Name="butOne" width="80" Command={Binding MyCommand}/>

it works fine .

but when I move this button to a cell template of datagrid control  , the command has no effect  .

why in cell template the command does no effect ?


Thanks .



Feb 18, 2010 at 7:46 AM


I have the same issue, have you found any solution to this problem?

My scenario is that i have a DelegateCommand in a PresentationModel that the view has as datacontext. It works just fine if I use a listview, but if I change it to a datagrid it stopps fireing and just gives me a: "Cannot find source for binding with reference 'ElementName=MyView'. BindingExpression:Path=DataContext.MyDelegateCommand; DataItem=null; target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand')"

Please send me an answer if you have found any solution to this!