You can try this code,
private void TextBox_GotFocus(object sender, RoutedEventArgs e) { String sSelectedText = mytextbox.SelectedText; }
If the user clicks on the copy icon that appears after the selection, he will be copied, if you want to do it programmatically, you can try this
DataPackage d = new DataPackage(); d.SetText(selectedText); Clipboard.SetContent(d);
I would suggest making a copy in some other event, rather than gotfocus, since this will be launched immediately after the user presses the text field, so that this method is called when the text has not been entered.
source share