// Token: 0x060048FB RID: 18683 RVA: 0x0014B1C0 File Offset: 0x001493C0
 internal override void OnInput(InputEventArgs e)
 {
     if (DataGridHelper.HasNonEscapeCharacters(e as TextCompositionEventArgs))
     {
         base.BeginEdit(e, true);
         return;
     }
     if (DataGridHelper.IsImeProcessed(e as KeyEventArgs) && base.DataGridOwner != null)
     {
         DataGridCell currentCellContainer = base.DataGridOwner.CurrentCellContainer;
         if (currentCellContainer != null && !currentCellContainer.IsEditing)
         {
             base.BeginEdit(e, false);
             base.Dispatcher.Invoke(delegate()
             {
             }, DispatcherPriority.Background);
         }
     }
 }
Ejemplo n.º 2
0
        internal override void OnInput(InputEventArgs e)
        {
            // Text input will start an edit.
            // Escape is meant to be for CancelEdit. But DataGrid
            // may not handle KeyDown event for Escape if nothing
            // is cancelable. Such KeyDown if unhandled by others
            // will ultimately get promoted to TextInput and be handled
            // here. But BeginEdit on escape could be confusing to the user.
            // Hence escape key is special case and BeginEdit is performed if
            // there is atleast one non espace key character.
            if (DataGridHelper.HasNonEscapeCharacters(e as TextCompositionEventArgs))
            {
                BeginEdit(e, true);
            }
            else if (DataGridHelper.IsImeProcessed(e as KeyEventArgs))
            {
                if (DataGridOwner != null)
                {
                    DataGridCell cell = DataGridOwner.CurrentCellContainer;
                    if (cell != null && !cell.IsEditing)
                    {
                        Debug.Assert(e.RoutedEvent == Keyboard.PreviewKeyDownEvent, "We should only reach here on the PreviewKeyDown event because the TextBox within is expected to handle the preview event and hence trump the successive KeyDown event.");

                        BeginEdit(e, false);

                        //
                        // The TextEditor for the TextBox establishes contact with the IME
                        // engine lazily at background priority. However in this case we
                        // want to IME engine to know about the TextBox in earnest before
                        // PostProcessing this input event. Only then will the IME key be
                        // recorded in the TextBox. Hence the call to synchronously drain
                        // the Dispatcher queue.
                        //
                        Dispatcher.Invoke((Action) delegate(){}, System.Windows.Threading.DispatcherPriority.Background);
                    }
                }
            }
        }