I have an app, where I generate text (about 500 characters), and I would like the user to have some means of copying that text for use outside of the application.
I don’t want to use any capabilities for this app (like web, or contacts).
Here’s what I’ve tried (and why it’s failed)
- TextBox. IsReadOnly = true; SelectAll();
- Can’t SelectAll a read only text box
- Turn off read only, hide the SIP
- Can’t hide the SIP on a (non-read-only) TextBox that the user is interacting with (I want to enable the user to copy, so needs to interact with the control)
- allow edits, show sip, SelectAll()
- The “copy” icon doesn’t appear unless the user chose to select text
- On selection changed (actually changed), SelectAll()
- The “copy” icon doesn’t appear unless the user selected the text? The copy icon appears erratically, nothing I would call an acceptable user experience.
So at this point, I’m quite far from what I want in a user experience, and I still don’t have anything that works. Any suggestions?
Some other possible ways to answer my question include:
- “How do I force the copy button to appear above text I programatically selected?”
- “How do I change the selection behavior of a tap in a text box?”
Here’s what I eventually got mostly working
Apparently, making the font size 1 makes the difference here, maybe because all of the text can appear on the screen at once? Who knows.
I accepted this answer, because no one else posted a better solution. I would appreciate a better solution. If you can get the SIP to go away, that would be awesome.