Exemplo n.º 1
0
        private void tw_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            TextWorker tw = sender as TextWorker;

            string newText = new TextRange(Modification.tb.Document.ContentStart, Modification.tb.Document.ContentEnd).Text;
            string textToInsert = ((string)tw.Content).Remove(0, 2);

            newText =  newText.Remove(tw.startIndex, (tw.endIndex - tw.startIndex));
            newText = newText.Insert(tw.startIndex, textToInsert);

            FlowDocument doc = new FlowDocument();

            Paragraph paragraph = new Paragraph();
            paragraph.Inlines.Add(new Run(newText));

            doc.Blocks.Add(paragraph);

            Modification.tb.Document = doc;

            Data = newText;

            FindErrors();

            Modification.sp.Children.Remove((UIElement)tw.Parent);

            Update();
        }