Back to results for “Clipboard”
.NET MAUI › Device Features & Essentials

How do you use the Clipboard and Share APIs?

Intermediate

Answer

Clipboard.Default.SetTextAsync/GetTextAsync copies and reads text. Share.Default.RequestAsync opens the OS share sheet with text or files (ShareTextRequest/ShareFileRequest), letting users send content to other apps.
await Clipboard.Default.SetTextAsync(couponCode);
await Share.Default.RequestAsync(new ShareTextRequest
{ Text = "Check this out!", Title = "Share" });
Real-world example A coupon screen copies the code to the clipboard and offers a Share button to send a referral link to friends.

Common follow-ups: How do you share a file? | Is Clipboard access async?