Specified argument was out of the range of valid values
final row is to add new row, want to disable delete button and confirm button as this row is only for adding new row
<DataGrid AutoGenerateColumns="True" ItemsSource="{Binding}" Name="dgStatus" HorizontalAlignment="Left" Margin="10,23,0,0" VerticalAlignment="Top" RenderTransformOrigin="-23.633,-5.198" Height="364" Width="811" CellEditEnding="myGrid_CellEditEnding" ><DataGrid.Columns><DataGridTemplateColumn><DataGridTemplateColumn.CellTemplate><DataTemplate><!--<Button Content="Delete" x:Name="btnDelete" Click="btnDelete_Click" IsEnabled="{Binding Path=BoolProp}"></Button>--><Button Content="Delete" x:Name="btnDelete" Click="btnDelete_Click" IsEnabled="{Binding Converter={StaticResource enableDisableConverter}}"></Button></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn><DataGridTemplateColumn><DataGridTemplateColumn.CellTemplate><DataTemplate><!--<Button Content="Delete" x:Name="btnDelete" Click="btnDelete_Click" IsEnabled="{Binding Path=BoolProp}"></Button>--><Button Content="Confirm" x:Name="btnConfirm" Click="btnConfirm_Click" IsEnabled="{Binding Converter={StaticResource enableDisableConverter}}" ></Button></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn></DataGrid.Columns></DataGrid> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { //int iIndex = ; try { if (value != null) { if (value.GetType().Name.Contains("DataRowView")) { if (!String.IsNullOrEmpty(((DataRowView)value).Row[0].ToString().Trim())) return true; else return false; } } } catch (System.Exception ex) { Console.WriteLine(""); } return false; }
No need to worry as many books are not the core and true story