إشعار
يتطلب الوصول إلى هذه الصفحة تخويلاً. يمكنك محاولة تسجيل الدخول أو تغيير الدلائل.
يتطلب الوصول إلى هذه الصفحة تخويلاً. يمكنك محاولة تغيير الدلائل.
The Screenshot class lets you take a capture of the current displayed screen of the app.
Get started
To start using this API, read the getting started guide for Xamarin.Essentials to ensure the library is properly installed and set up in your projects.
Using Screenshot
Add a reference to Xamarin.Essentials in your class:
using Xamarin.Essentials;
Then call CaptureAsync to take a screenshot of the current screen of the running application. This will return back a ScreenshotResult that can be used to get the Width, Height, and a Stream of the screenshot taken.
async Task CaptureScreenshot()
{
var screenshot = await Screenshot.CaptureAsync();
var stream = await screenshot.OpenReadAsync();
Image = ImageSource.FromStream(() => stream);
}
Limitations
Not all views support being captured at a screen level such as an OpenGL view.