private void TbxCode_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Space && Modifiers.NoModifiersDown)
     {
         CodeTemplate templateToExpand = TemplateEngine.GetTemplateToExpand(TextEditor);
         if (templateToExpand != null)
         {
             e.Handled = true;
             TextCompletionEngine.HideCodeCompletionWindow();
             TemplateEngine.ExpandTemplate(TextEditor, templateToExpand);
         }
     }
     else if (IsNavKey(e.Key) || e.Key == Key.OemComma && Modifiers.NoModifiersDown)
     {
         StartTooltipTimer();
     }
 }
示例#2
0
 /// <summary>
 /// Expands the specified template at the caret position.
 /// </summary>
 public void ExpandTemplate(TextEditor textBox, CodeTemplate templateToExpand)
 {
     DeleteTemplate(textBox.TextArea, templateToExpand.Template);
     ExpandTemplate(textBox.TextArea, templateToExpand.Expansion);
 }