private void InsertPlaceholderExec(object sender, ExecutedRoutedEventArgs e) { if (PathEditor == null) { PathPattern += (string)e.Parameter; //Fallback position, just append the placeholder to the path text } else { //If there is a path editor text box, put the placeholder at the insertion point PathEditor.SelectedText = (string)e.Parameter; PathEditor.Select(PathEditor.SelectionStart + PathEditor.SelectionLength, 0); PathEditor.Focus(); } }