Stack Exchange
WindowsForms TextBox Method Paste also in WPF TextBox?
In WindowsForms i use this samlpe code: 
textBox.Paste("some text");

Is there a TextBox method with the same function in WPF?
Or there is a nice workaround?

Maby this workaround to use the Textox in WPF helps: http://www.c-sharpcorner.com/uploadfile/mahesh/using-windows-forms-controls-in-wpf/

    public static void Paste(this TextBox textbox, string textToInsert)
    {
        int caretIndex = textbox.CaretIndex;
        string textBoxContent;

        if (textbox.SelectedText.Length > 0)
        {
            textBoxContent = textbox.Text.Remove(caretIndex, textbox.SelectedText.Length);
        }
        else
        {
            textBoxContent = textbox.Text;
        }

        textbox.Text = textBoxContent.Insert(caretIndex, textToInsert);
        textbox.CaretIndex = caretIndex + textToInsert.Length;
    }


Use the Clipboard class:
textBox1.Text = Clipboard.GetText();

or use the SelectedText property of the textbox:
textBox1.SelectedText = "some text";


Probably this is not the same, since Paste does replace the currently selected text, whereas your solution will replace all text.

Additionally, you use the clipboard whereas the original poster does not use the clipboard.
