private void FormulaAutoComplete_NodeSelected(object sender, NodeSelectedArg e)
        {
            if (e.PropertyType == NodeType.Method)
            {
                richTextBox.Insert(e.NodePath);
                if (e.NodePath.Contains("(") && e.NodePath.Contains(")"))
                {
                    var fIndex   = e.NodePath.IndexOf("(");
                    var lIndex   = e.NodePath.IndexOf(")");
                    var lenght   = lIndex - fIndex;
                    var paramStr = e.NodePath.Substring((fIndex + 1), lenght - 1);

                    if (!string.IsNullOrEmpty(paramStr))
                    {
                        if (!paramStr.Contains("[]"))
                        {
                            SelectText(paramStr);
                        }
                    }
                }
            }
            else
            {
                richTextBox.Insert(e.NodePath);
            }
            autoCompleteWindow.Close();
            richTextBox.Focus();
        }
Beispiel #2
0
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
        {
            string payloadData = DragDropPayloadManager.GetDataFromObject(args.Data, "DragData") as string;

            if (string.IsNullOrEmpty(payloadData))
            {
                return;
            }
            RadRichTextBox mainEditor = sender as RadRichTextBox;

            RadRichTextBox richTextBox = mainEditor.ActiveDocumentEditor as RadRichTextBox;

            richTextBox.CurrentEditingStyle.SpanProperties.ForeColor = Colors.Red;
            Dispatcher.BeginInvoke(new Action(delegate()
            {
                mainEditor.Focus();
                richTextBox.Insert(payloadData);
            }));
        }