/// <summary>
        ///     Called when a cell has just switched to edit mode.
        /// </summary>
        /// <param name="editingElement">A reference to element returned by GenerateEditingElement.</param>
        /// <param name="editingEventArgs">The event args of the input event that caused the cell to go into edit mode. May be null.</param>
        /// <returns>The unedited value of the cell.</returns>
        protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
        {
            //PactComboBoxData CMB = new PactComboBoxData()
            //{
            //    IsPartiralData = IsPartiralData,
            //    FeatureID = FeatureID,
            //    CompanyIndex = Convert.ToInt32(CompanyIndex),
            //    Label = strLable,
            //    Mandatory = IsMandatory,
            //    DataType = DataType,
            //    DBColumnName = ColumnName,
            //    Enable = IsReadOnly,
            //};


            PactComboBox textBox = editingElement as PactComboBox;

            if (textBox != null)
            {
                textBox.Focus();

                string originalValue = textBox.Text;

                TextCompositionEventArgs textArgs = editingEventArgs as TextCompositionEventArgs;
                //if (textArgs != null)
                //{
                //    // If text input started the edit, then replace the text with what was typed.
                //    string inputText = textArgs.Text;
                //    textBox.Text = inputText;

                //    // Place the caret after the end of the text.
                //    textBox.Select(inputText.Length, 0);
                //}
                //else
                //{
                //    // If a mouse click started the edit, then place the caret under the mouse.
                //    MouseButtonEventArgs mouseArgs = editingEventArgs as MouseButtonEventArgs;
                //    if ((mouseArgs == null) || !PlaceCaretOnTextBox(textBox, Mouse.GetPosition(textBox)))
                //    {
                //        // If the mouse isn't over the textbox or something else started the edit, then select the text.
                //        textBox.SelectAll();
                //    }
                //}

                return(originalValue);
            }

            return(null);
        }
        /// <summary>
        ///     Called when a cell has just switched to edit mode.
        /// </summary>
        /// <param name="editingElement">A reference to element returned by GenerateEditingElement.</param>
        /// <param name="editingEventArgs">The event args of the input event that caused the cell to go into edit mode. May be null.</param>
        /// <returns>The unedited value of the cell.</returns>
        protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
        {
            PactComboBox PactComboBox = editingElement as PactComboBox;

            if (PactComboBox != null)
            {
                PactComboBox.Focus();
                object originalValue = GetPactComboBoxSelectionValue(PactComboBox);

                if (IsPactComboBoxOpeningInputEvent(editingEventArgs))
                {
                    PactComboBox.IsDropDownOpen = true;
                }

                return(originalValue);
            }

            return(null);
        }
        /// <summary>
        ///     Called when a cell has just switched to edit mode.
        /// </summary>
        /// <param name="editingElement">A reference to element returned by GenerateEditingElement.</param>
        /// <param name="editingEventArgs">The event args of the input event that caused the cell to go into edit mode. May be null.</param>
        /// <returns>The unedited value of the cell.</returns>
        protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
        {
            PactComboBox textBox = editingElement as PactComboBox;

            if (textBox != null)
            {
                textBox.Focus();

                string originalValue = textBox.Text;

                //TextCompositionEventArgs textArgs = editingEventArgs as TextCompositionEventArgs;
                //if (textArgs != null)
                //{
                //    // If text input started the edit, then replace the text with what was typed.
                //    string inputText = textArgs.Text;
                //    textBox.Text = inputText;

                //    // Place the caret after the end of the text.
                //    textBox.Select(inputText.Length, 0);
                //}
                //else
                //{
                //    // If a mouse click started the edit, then place the caret under the mouse.
                //    MouseButtonEventArgs mouseArgs = editingEventArgs as MouseButtonEventArgs;
                //    if ((mouseArgs == null) || !PlaceCaretOnTextBox(textBox, Mouse.GetPosition(textBox)))
                //    {
                //        // If the mouse isn't over the textbox or something else started the edit, then select the text.
                //        textBox.SelectAll();
                //    }
                //}

                return(originalValue);
            }

            return(null);
        }