void CaseDataAddMenuitem_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         MenuItem menuitem = sender as MenuItem;
         if (!_chatUtil.UserData.ContainsKey(menuitem.Header.ToString()))
         {
             _chatUtil.UserData.Add(menuitem.Header.ToString(), string.Empty);
         }
         if (_chatUtil.NotifyCaseData.Count(p => p.Key == menuitem.Header.ToString()) == 0)
         {
             _chatUtil.NotifyCaseData.Add(new ChatCaseData(menuitem.Header.ToString(), string.Empty));
         }
         BindGrid();
         _caseDataAdd.Items.Remove(menuitem);
         DGCaseDataInfo.UpdateLayout();
         if (DGCaseDataInfo.Items.Count > 2)
         {
             DGCaseDataInfo.ScrollIntoView(DGCaseDataInfo.Items[DGCaseDataInfo.Items.Count - 2]);
         }
         int rowIndex         = _chatUtil.NotifyCaseData.IndexOf(_chatUtil.NotifyCaseData.Where(p => p.Key == menuitem.Header.ToString()).FirstOrDefault());
         var dataGridCellInfo = new Microsoft.Windows.Controls.DataGridCellInfo(DGCaseDataInfo.Items[rowIndex], DGCaseDataInfo.Columns[1]);
         var cell             = TryToFindGridCell(DGCaseDataInfo, dataGridCellInfo);
         if (cell == null)
         {
             return;
         }
         cell.Focus();
         DGCaseDataInfo.BeginEdit();
     }
     catch (Exception commonException)
     {
         _logger.Error("Error occurred as : " + commonException.Message.ToString());
     }
 }
        /// <summary>
        /// Handles the Click event of the CaseDataAddMenuitem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        void CaseDataAddMenuitem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MenuItem menuitem = sender as MenuItem;
                //DGCaseDataInfo.UpdateLayout();
                emailDetails.EmailCaseData.Add(new EmailCaseData()
                {
                    Key = menuitem.Header.ToString(), Value = string.Empty
                });
                if (!CurrentData.ContainsKey(menuitem.Header.ToString()))
                {
                    CurrentData.Add(menuitem.Header.ToString(), "");
                }
                DGCaseDataInfo.UpdateLayout();
                //BindGrid();
                if (DGCaseDataInfo.Items.Count > 2)
                {
                    DGCaseDataInfo.ScrollIntoView(DGCaseDataInfo.Items[DGCaseDataInfo.Items.Count - 2]);
                }
                int rowIndex         = emailDetails.EmailCaseData.IndexOf(emailDetails.EmailCaseData.Where(x => x.Key.Equals(menuitem.Header.ToString())).SingleOrDefault());
                var dataGridCellInfo = new Microsoft.Windows.Controls.DataGridCellInfo(DGCaseDataInfo.Items[rowIndex], DGCaseDataInfo.Columns[1]);
                var cell             = TryToFindGridCell(DGCaseDataInfo, dataGridCellInfo);
                if (cell == null)
                {
                    return;
                }
                cell.Focus();
                DGCaseDataInfo.BeginEdit();
                _caseDataAdd.Items.Remove(menuitem);
                editingKey   = menuitem.Header.ToString();
                editingValue = string.Empty;

                if (_caseDataAdd.Items.Count == 0)
                {
                    // Addded by sakthi to hide, if there is no item available to add after added all item.
                    // Date : 20-02-2016

                    btnAddCaseData.Visibility = Visibility.Collapsed;
                }
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred as : " + commonException.Message.ToString());
            }
        }