Question

As the new (January 2011) Update to the Windows Phone Developer Tools adds support for Cut and Paste, can this be used programatically in code?

Was it helpful?

Solution

No.

The January 2011 update does not include programatic access to the clipboard (or any new APIs). The clipboard can only be accessed by the user to cut and paste text. Yes, only text can be cut, copied and pasted.

Cut and paste functionality has been added to all textboxes and textboxes within your application will automatically get this ability when run on the updated emulator or a device which has had the update applied. This applies even if you make the textbox readonly.

If you are using a textbox within a Pivot or Panorama (which the guidelines advise against) you should review your app with regard to any possible problems in this area. (Sliding with a finger to expand the selected area may cause the pivot or panorama to slide. You probably don't want this.)

Mango Update

Mango (v7.1) introduces programmatic access to the Clipboard but only for setting text, not getting any text which is already there.

From MSDN:

"You cannot get clipboard text from a Windows Phone application, only set it. Calling the GetText method in a Windows Phone application will always cause a SecurityException to occur."

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top