Clipboard API in Windows Phone

In this post we will see Clipboard API support in Windows Phone. Clipboard API support came as part of Windows Phone 7.5 and it was not part of Windows Phone 7.

Class is defined in System.Windows namespace as below,

clip_image002

You can set text as below,

clip_image004

In above snippet txtSource is a text box. You can check whether clipboard has some data or not as below,

clip_image006

One very important point you need to keep in mind that you cannot use GetText() method in Windows Phone. If you try to do that you will get security exception as below,

clip_image007

For security reason access to clipboard data is prohibited in Windows Phone. In this way you can use Windows Phone Clipboard API. I hope this post is useful. Thanks for reading .

 

3 responses to “Clipboard API in Windows Phone”

  1. […] Clipboard API in Windows Phone (Dhananjay Kumar) […]

  2. […] Clipboard API in Windows Phone […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com