private void DetailGrid_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Down)
     {
         var currentRowIndex = (_viewModel.SelectedMainRow.DetailsList.IndexOf(_viewModel.SelectedDetailRow));
         if (currentRowIndex == (_viewModel.SelectedMainRow.DetailsList.Count - 1))
         {
             _viewModel.AddNewDetailRow(true);
             DetailGrid.BeginEdit();
         }
     }
     if (e.Key == Key.Delete && ModifierKeys.Shift == Keyboard.Modifiers)
     {
         if (!_viewModel.SelectedMainRow.Approved)
         {
             _viewModel.SelectedDetailRows.Clear();
             foreach (var row in DetailGrid.SelectedItems)
             {
                 _viewModel.SelectedDetailRows.Add((TblGlChequeTransactionDetailViewModel)row);
             }
             _viewModel.DeleteDetailRow();
         }
     }
     try { } catch { }
 }
        private void DetailGrid_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Down)
            {
                var currentRowIndex = (_viewModel.SelectedDetailRow.DetailsList.IndexOf(_viewModel.SelectedSubDetailRow));
                if (currentRowIndex == (_viewModel.SelectedDetailRow.DetailsList.Count - 1))
                {
                    _viewModel.AddNewSubDetailRow(true);
                    DetailGrid.BeginEdit();
                }
            }
            if (e.Key == Key.Delete && ModifierKeys.Shift == Keyboard.Modifiers)
            {
                _viewModel.SelectedSubDetailRows.Clear();
                foreach (var row in DetailGrid.SelectedItems)
                {
                    _viewModel.SelectedSubDetailRows.Add((TblLedgerMainDetailCostCenterViewModel)row);
                }

                _viewModel.DeleteSubDetailRow();
            }
            else if (e.Key == Key.Tab)
            {
                if (DetailGrid.CurrentColumn != null)
                {
                    var index = DetailGrid.Columns.IndexOf(DetailGrid.CurrentColumn);
                    if (index == DetailGrid.Columns.Count - 1)
                    {
                        var currentRowIndex = (_viewModel.SelectedDetailRow.DetailsList.IndexOf(_viewModel.SelectedSubDetailRow));
                        if (currentRowIndex == (_viewModel.SelectedDetailRow.DetailsList.Count - 1))
                        {
                            _viewModel.AddNewSubDetailRow(true);
                            DetailGrid.BeginEdit();
                        }
                    }
                }
            }
        }
 private void TblPeriodLineDataGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     _viewModel.SaveSubDetailRow();
     DetailGrid.BeginEdit();
 }
 private void DetailGrid_OnLoaded(object sender, RoutedEventArgs e)
 {
     DetailGrid.SelectedIndex = 0;
     DetailGrid.BeginEdit();
 }