简体   繁体   中英

How to copy file to clipboard in XamrinForms

I tried to write file to xamarin forms and then copy to clipboard but i have no idea how can i copy file to clipboard any help will be appreciated.

string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "temp.txt");
            File.WriteAllText(fileName, "Hello Wolkhjkhjkrld");
            String file = "";
            using (StreamReader sr = new StreamReader(fileName))
            {
                file = sr.ReadToEnd();
            } 

So i want to copy that file to clipboard

use Xamarin Essentials Clipboard

await Clipboard.SetTextAsync("Hello World");

var text = await Clipboard.GetTextAsync();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM