Given the DataTemplate in which the button is defined:
<DataTemplate DataType="{x:Type localVM:SwitchISViewModel}"> <Grid Background="..."}" > <Button Margin="5" Content="{Binding Name}" Command="{Binding ExecuteComand}" /> </Grid> </DataTemplate> Further in Grid I use this Template
<Grid> <StackPanel> <ContentControl Margin="4" Content="{Binding SwitchIS[0]}" > </ContentControl> <ContentControl Margin="4" Content="{Binding SwitchIS[1]}" > </ContentControl> </StackPanel> </Grid> where SwitchIS is the SwitchISViewModel array defined in MainViewModel. The fact is that everything is attached. The first time I click on a Button, I get into the ExecuteComand. Then it does not click. What can be wrong.
ps Tried to do through ContentPresenter: Defined
<DataTemplate x:Key="TemplateVM"> .... Instead of ContentControl pasted ContentPresenter
<ContentPresenter Content="{Binding SwitchIS[0]}" ContentTemplate="{StaticResource TemplateVM}" /> The result is the same.