I have a Button template to define what my edit button should look like:
<ControlTemplate x:Key="EditButton" TargetType="{x:Type Button}">
<Button Style="{StaticResource GrayOutButtonStyle}" >
<Image x:Name="editImage" Source="{StaticResource EditIcon}" />
</Button>
</ControlTemplate>
I want to declare the Command in the XAML where I create the button (not in the template). But when I set the Command attribute in the Button, it's being ignored:
<Button Template="{StaticResource EditButton}"
Command="{Binding Source={StaticResource ViewModel}, Path=EditCommand}"
CommandParameter="{Binding}" />
What's wrong with my syntax?
(Note: If I remove the template from this button then the Command works, so it's something about using a template that's messing it up.).