There is an IsEditing dependency property on the DataGridRow so you can probably do this with XAML and a couple of converters. The main bits of the XAML look something like this
<Window.Resources>
<viewModel:BooleanVisibleConverter x:Key="boolVisConv"/>
<viewModel:InverseBooleanVisibleConverter x:Key="invBoolVisConv"/>
<DataTemplate x:Key="DataGridButtonsTemplate">
<StackPanel >
<Button Content="Delete" Visibility ="{Binding IsEditing, Mode=OneWay, Converter={StaticResource invBoolVisConv}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGridRow}}"/>
<Button Content="OK" Visibility="{Binding IsEditing, Mode=OneWay, Converter={StaticResource boolVisConv},RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGridRow}}"/>
<Button Content="Cancel" Visibility="{Binding IsEditing, Mode=OneWay, Converter={StaticResource boolVisConv},RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGridRow}}"/>
</StackPanel>
</DataTemplate>
</Window.Resources>
<DataGrid Grid.Row="1" ItemsSource="{Binding MyData}" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding FirstField}" Header="First Property"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding SecondField}" Header="Second Property"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding ThirdField}" Header="Third Property"></DataGridTextColumn>
<DataGridTemplateColumn Header="Control" CellTemplate="{StaticResource DataGridButtonsTemplate}"></DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
An example converter is here, obviously you will need two of these, the second will have the return value reversed
[ValueConversion(typeof(bool), typeof(Visibility))]
public class BooleanVisibleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
if (targetType != typeof(Visibility))
throw new InvalidOperationException("The target must be a System.Windows.Visibility");
return ((bool)value)? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
You will need to figure out which button was pressed as there are will be one per row. There are a couple of ideas as to how to do that here
WPF DataGrid - Button in a column, getting the row from which it came on the Click event handler